doc: hpfall.c: fix missing null-terminate after strncpy call
Added a guaranteed null-terminate after call to strncpy. This was partly found using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
429a91db3b
commit
d5ae11dc40
@ -28,6 +28,7 @@ int set_unload_heads_path(char *device)
|
||||
if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
|
||||
return -EINVAL;
|
||||
strncpy(devname, device + 5, sizeof(devname));
|
||||
devname[sizeof(devname) - 1] = '\0';
|
||||
|
||||
snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
|
||||
"/sys/block/%s/device/unload_heads", devname);
|
||||
|
Loading…
Reference in New Issue
Block a user