summaryrefslogtreecommitdiff
path: root/app/proc-info
diff options
context:
space:
mode:
authorRadu Nicolau <radu.nicolau@intel.com>2018-02-20 13:52:22 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-03-28 00:35:37 +0200
commitf0b9479497741040476aae5008afe84e0467e586 (patch)
treee9a120577e49c8785326469a207e8399879d3eb2 /app/proc-info
parentfada6963ce735048b2d40f215ff110cb2f4cb6a4 (diff)
downloaddpdk-f0b9479497741040476aae5008afe84e0467e586.zip
dpdk-f0b9479497741040476aae5008afe84e0467e586.tar.gz
dpdk-f0b9479497741040476aae5008afe84e0467e586.tar.xz
app/procinfo: fix strncpy usage in args parsing
Replace strncpy with snprintf to avoid overwriting the last NULL character. Coverity issue: 143252 Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau <radu.nicolau@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'app/proc-info')
-rw-r--r--app/proc-info/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 2f53e3c..f90c144 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -159,7 +159,7 @@ proc_info_preparse_args(int argc, char **argv)
proc_info_usage(prgname);
return -1;
}
- strncpy(host_id, argv[i+1], sizeof(host_id));
+ snprintf(host_id, sizeof(host_id), "%s", argv[i+1]);
}
}