From: Rickard Strandqvist Date: Wed, 4 Jun 2014 21:28:10 +0000 (+0200) Subject: doc: hpfall.c: fix missing null-terminate after strncpy call X-Git-Tag: v3.17-rc1~96^2~10 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d5ae11dc402f64a3b79ef6754487429b772f3e71;p=karo-tx-linux.git 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 Signed-off-by: Jiri Kosina --- 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) 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);