aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>2014-06-04 17:28:10 -0400
committerJiri Kosina <jkosina@suse.cz>2014-06-19 09:20:26 -0400
commitd5ae11dc402f64a3b79ef6754487429b772f3e71 (patch)
tree219affe16d69bfed760501b5e9efefa64cbffbe9 /Documentation
parent429a91db3b3e7f755b1e9fa3bcd95660d84697ad (diff)
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>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/laptops/hpfall.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Documentation/laptops/hpfall.c b/Documentation/laptops/hpfall.c
index b85dbbac0499..67084321dab4 100644
--- a/Documentation/laptops/hpfall.c
+++ b/Documentation/laptops/hpfall.c
@@ -28,6 +28,7 @@ int set_unload_heads_path(char *device)
28 if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0) 28 if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
29 return -EINVAL; 29 return -EINVAL;
30 strncpy(devname, device + 5, sizeof(devname)); 30 strncpy(devname, device + 5, sizeof(devname));
31 devname[sizeof(devname) - 1] = '\0';
31 32
32 snprintf(unload_heads_path, sizeof(unload_heads_path) - 1, 33 snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
33 "/sys/block/%s/device/unload_heads", devname); 34 "/sys/block/%s/device/unload_heads", devname);