kmodloader/get_module_name: null-terminate the string
authorAlexander Couzens <lynxis@fe80.eu>
Sun, 11 Jun 2017 10:13:05 +0000 (12:13 +0200)
committerAlexander Couzens <lynxis@fe80.eu>
Sun, 11 Jun 2017 12:29:13 +0000 (14:29 +0200)
Found-by: Coverity Scan #1412291
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
kmodloader.c

index ed8f833fc3932caa7bfcc54228e21bd460a1a728..9aba52392d1e06fe69aee6f3101ce4ed78aee28e 100644 (file)
@@ -155,10 +155,10 @@ static char* get_module_path(char *name)
 
 static char* get_module_name(char *path)
 {
-       static char name[32];
+       static char name[33];
        char *t;
 
-       strncpy(name, basename(path), sizeof(name));
+       strncpy(name, basename(path), sizeof(name) - 1);
 
        t = strstr(name, ".ko");
        if (t)