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.
This commit is contained in:
Giacomo Tesio 2017-01-17 00:18:18 +01:00
parent 41a9489dd4
commit 20f15cbe5a
1 changed files with 1 additions and 1 deletions

View File

@ -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);