DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: john.mcnamara@intel.com, maryam.tahhan@intel.com,
	reshma.pattan@intel.com, Radu Nicolau <radu.nicolau@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH] app/procinfo: fix strncpy count issue
Date: Tue, 20 Feb 2018 12:57:36 +0000	[thread overview]
Message-ID: <1519131456-9928-1-git-send-email-radu.nicolau@intel.com> (raw)

Change strncpy count parameter to MAX_LONG_OPT_SZ-1 to avoid
overwriting the last NULL character and for consistency.

Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id")
Coverity issue: 30688

Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 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..5f0b745 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));
+			strncpy(host_id, argv[i+1], MAX_LONG_OPT_SZ-1);
 		}
 	}
 
-- 
2.7.5

             reply	other threads:[~2018-02-20 13:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 12:57 Radu Nicolau [this message]
2018-02-20 13:00 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
2018-02-20 13:52   ` [dpdk-dev] [PATCH v3] " Radu Nicolau
2018-02-20 14:16     ` 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=1519131456-9928-1-git-send-email-radu.nicolau@intel.com \
    --to=radu.nicolau@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).