From: Radu Nicolau Date: Tue, 20 Feb 2018 13:52:22 +0000 (+0000) Subject: app/procinfo: fix strncpy usage in args parsing X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f0b9479497741040476aae5008afe84e0467e586;p=dpdk.git 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 Acked-by: Bruce Richardson --- diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 2f53e3caa4..f90c14498b 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]); } }