From 20f15cbe5ac602d99b9ee82258ee301f64c81dc0 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Tue, 17 Jan 2017 00:18:18 +0100 Subject: [PATCH] kernel: fix not null terminated string in options() CID 155471 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)67. buffer_size_warning: Calling strncpy with a maximum size argument of 256 bytes on destination array envcopy of size 256 bytes might leave the destination string unterminated. --- sys/src/kern/amd64/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/kern/amd64/main.c b/sys/src/kern/amd64/main.c index 4c1bd54..a5ee393 100644 --- a/sys/src/kern/amd64/main.c +++ b/sys/src/kern/amd64/main.c @@ -95,7 +95,7 @@ options(int argc, char* argv[]) }else if(strcmp(next, "idlespin") == 0){ onIdleSpin(); }else{ - strncpy(envcopy, next, sizeof envcopy); + strncpy(envcopy, next, sizeof(envcopy)-1); gettokens(envcopy, env, 2, "="); if(strcmp(env[0], "maxcores") == 0){ maxcores = strtol(env[1], 0, 0);