Skip to content

Commit 9660968

Browse files
JustinStittdtor
authored andcommitted
Input: synaptics-rmi4 - replace deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1] Let's use memcpy() as the bounds have already been checked and this decays into a simple byte copy from one buffer to another removing any ambiguity that strncpy has. Signed-off-by: Justin Stitt <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/20230921-strncpy-drivers-input-rmi4-rmi_f34-c-v1-1-4aef2e84b8d2@google.com Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent c50fdc4 commit 9660968

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/rmi4/rmi_f34.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static ssize_t rmi_driver_update_fw_store(struct device *dev,
471471
if (buf[count - 1] == '\0' || buf[count - 1] == '\n')
472472
copy_count -= 1;
473473

474-
strncpy(fw_name, buf, copy_count);
474+
memcpy(fw_name, buf, copy_count);
475475
fw_name[copy_count] = '\0';
476476

477477
ret = request_firmware(&fw, fw_name, dev);

0 commit comments

Comments
 (0)