Skip to content

Commit b6ed2f7

Browse files
azeemshaikh38kees
authored andcommitted
EISA: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [2] KSPP#89 Signed-off-by: Azeem Shaikh <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]> # diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c # index 713582c..33f0ba1 100644 # --- a/drivers/eisa/eisa-bus.c # +++ b/drivers/eisa/eisa-bus.c # @@ -60,7 +60,7 @@ static void __init eisa_name_device(struct eisa_device *edev) # int i; # for (i = 0; i < EISA_INFOS; i++) { # if (!strcmp(edev->id.sig, eisa_table[i].id.sig)) { # - strlcpy(edev->pretty_name, # + strscpy(edev->pretty_name, # eisa_table[i].name, # sizeof(edev->pretty_name)); # return;
1 parent c9732f1 commit b6ed2f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/eisa/eisa-bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void __init eisa_name_device(struct eisa_device *edev)
6060
int i;
6161
for (i = 0; i < EISA_INFOS; i++) {
6262
if (!strcmp(edev->id.sig, eisa_table[i].id.sig)) {
63-
strlcpy(edev->pretty_name,
63+
strscpy(edev->pretty_name,
6464
eisa_table[i].name,
6565
sizeof(edev->pretty_name));
6666
return;

0 commit comments

Comments
 (0)