42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
From 2b126beda6e76f89fb95c14bc421bc13a376cf2e Mon Sep 17 00:00:00 2001
|
|
From: Clark Williams <williams@redhat.com>
|
|
Date: Tue, 19 Feb 2019 16:10:38 +0100
|
|
Subject: [PATCH] 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
|
|
---
|
|
src/cyclictest/cyclictest.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
|
|
index 68b3836405c1..1bd63fd93dce 100644
|
|
--- a/src/cyclictest/cyclictest.c
|
|
+++ b/src/cyclictest/cyclictest.c
|
|
@@ -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:
|
|
--
|
|
2.20.1
|
|
|