docs: stop suggesting strlcpy

Since strlcpy is deprecated, the documentation shouldn't suggest using
it. This patch fixes the examples to use strscpy instead. It also uses
sizeof instead of underlying constants as far as possible, to simplify
future changes to the corresponding data structures.

Signed-off-by: Stephen Kitt <[email protected]>
Acked-by: Kees Cook <[email protected]>
Acked-by: Federico Vaga <[email protected]>
Signed-off-by: Jonathan Corbet <[email protected]>
This commit is contained in:
Stephen Kitt 2019-06-13 18:25:48 +02:00 • committed by Jonathan Corbet
commit 220ee02a0b
5 changed files with 12 additions and 12 deletions

View file

@ -194,9 +194,9 @@ with HID core:
goto err_<...>;
}
strlcpy(hid->name, <device-name-src>, 127);
strlcpy(hid->phys, <device-phys-src>, 63);
strlcpy(hid->uniq, <device-uniq-src>, 63);
strscpy(hid->name, <device-name-src>, sizeof(hid->name));
strscpy(hid->phys, <device-phys-src>, sizeof(hid->phys));
strscpy(hid->uniq, <device-uniq-src>, sizeof(hid->uniq));
hid->ll_driver = &custom_ll_driver;
hid->bus = <device-bus>;