From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: john.mcnamara@intel.com, maryam.tahhan@intel.com,
reshma.pattan@intel.com, bruce.richardson@intel.com,
Radu Nicolau <radu.nicolau@intel.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3] app/procinfo: fix strncpy count issue
Date: Tue, 20 Feb 2018 13:52:22 +0000 [thread overview]
Message-ID: <1519134742-22648-1-git-send-email-radu.nicolau@intel.com> (raw)
In-Reply-To: <1519131621-10053-1-git-send-email-radu.nicolau@intel.com>
Replace strncpy with snprintf to avoid overwriting the last
NULL character.
Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id")
Coverity issue: 143252
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v3: replaced strncpy with snprintf
app/proc_info/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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]);
}
}
--
2.7.5
next prev parent reply other threads:[~2018-02-20 13:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 12:57 [dpdk-dev] [PATCH] " Radu Nicolau
2018-02-20 13:00 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
2018-02-20 13:52 ` Radu Nicolau [this message]
2018-02-20 14:16 ` [dpdk-dev] [PATCH v3] " Bruce Richardson
2018-03-27 22:25 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-02-20 13:29 ` [dpdk-dev] [PATCH] " Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519134742-22648-1-git-send-email-radu.nicolau@intel.com \
--to=radu.nicolau@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=john.mcnamara@intel.com \
--cc=maryam.tahhan@intel.com \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).