cyclictest: Fix compiler warning about srncpy output truncated

Fix compiler warning about strncpy output truncated before terminating
nul copying as many bytes from a string as its length

Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Extracted from a patch from Clark
This commit is contained in:
Clark Williams 2019-02-19 16:10:38 +01:00 committed by John Kacur
parent 153c8171e0
commit 2b126beda6
1 changed files with 2 additions and 2 deletions

View File

@ -1257,7 +1257,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
case 'F':
case OPT_FIFO:
use_fifo = 1;
strncpy(fifopath, optarg, strlen(optarg));
strncpy(fifopath, optarg, strnlen(optarg, MAX_PATH-1));
break;
case 'H':
case OPT_HISTOFALL:
@ -1267,7 +1267,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
histogram = atoi(optarg); break;
case OPT_HISTFILE:
use_histfile = 1;
strncpy(histfile, optarg, strlen(optarg));
strncpy(histfile, optarg, strnlen(optarg, MAX_PATH-1));
break;
case 'i':
case OPT_INTERVAL: