Skip to content

Commit d134ad2

Browse files
Jason Wangcminyard
authored andcommitted
ipmi: ssif: replace strlcpy with strscpy
The strlcpy should not be used because it doesn't limit the source length. So that it will lead some potential bugs. But the strscpy doesn't require reading memory from the src string beyond the specified "count" bytes, and since the return value is easier to error-check than strlcpy()'s. In addition, the implementation is robust to the string changing out from underneath it, unlike the current strlcpy() implementation. Thus, replace strlcpy with strscpy. Signed-off-by: Jason Wang <wangborong@cdjrlc.com> Message-Id: <20211222032707.1912186-1-wangborong@cdjrlc.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
1 parent 7281599 commit d134ad2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ static int ssif_detect(struct i2c_client *client, struct i2c_board_info *info)
13541354
if (rv)
13551355
rv = -ENODEV;
13561356
else
1357-
strlcpy(info->type, DEVICE_NAME, I2C_NAME_SIZE);
1357+
strscpy(info->type, DEVICE_NAME, I2C_NAME_SIZE);
13581358
kfree(resp);
13591359
return rv;
13601360
}

0 commit comments

Comments
 (0)