From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by dpdk.org (Postfix) with ESMTP id 704AC5A4B for ; Tue, 1 Sep 2015 03:58:59 +0200 (CEST) Received: by pabzx8 with SMTP id zx8so158046458pab.1 for ; Mon, 31 Aug 2015 18:58:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1ae8PGL+EJQRU04uP2Az9gY+9FqeSfxsoYDucNHTBRc=; b=EdqIwF5jpCWDwLf65KQwWSW3Yww8QLv3oAAoyDYJKI4QW4km4iVsEvPxqUbM5AfniK 4gYjdO8BKMAyKGMvNC/DqOo7U8aPOn4KeLXiy5R77G7K947wVCliTRBpLgvoVBtByMtt vz90no2RZ/3J0AS6Vg5jr7P1gPV1IUtwXxh1w0GS1BCnzZM8S3Q5/Dm///as3LQAHGH/ u5lg1LYIRADe8QaNB2kUZQI70WYQOc+k3zVh4+QznQWEXgCZmB5Q9j8KnAV5GbQ7zZUP 3HXsgnIx73uNm4NVTsV9yJ6efBJMnE7PFqLgxZ8B5MENyhRYM+g7cAbZkTAXf9Wsx0ZM 97Ng== X-Gm-Message-State: ALoCoQk2z6oRBA/nHBLrFOG6xg2XnPwr+UgOAGePepz60/hOI/SNSXJMMGtFE3DPX9KTywl6qYD+ X-Received: by 10.66.139.234 with SMTP id rb10mr42449219pab.118.1441072738852; Mon, 31 Aug 2015 18:58:58 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id ld8sm15988418pbc.61.2015.08.31.18.58.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Aug 2015 18:58:58 -0700 (PDT) From: Stephen Hemminger To: cristian.dumitrescu@intel.com Date: Mon, 31 Aug 2015 18:59:03 -0700 Message-Id: <1441072746-29174-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441072746-29174-1-git-send-email-stephen@networkplumber.org> References: <1441072746-29174-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH 2/5] example_ip_pipeline: avoid strncpy issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2015 01:59:00 -0000 If name is so long that it fills buffer, then string would not be null terminated. Signed-off-by: Stephen Hemminger --- examples/ip_pipeline/config_parse_tm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/ip_pipeline/config_parse_tm.c b/examples/ip_pipeline/config_parse_tm.c index 84702b0..4a35715 100644 --- a/examples/ip_pipeline/config_parse_tm.c +++ b/examples/ip_pipeline/config_parse_tm.c @@ -354,7 +354,9 @@ tm_cfgfile_load_sched_subport( profile = atoi(entries[j].value); strncpy(name, entries[j].name, - sizeof(name)); + CFG_NAME_LEN - 1); + name[CFG_NAME_LEN-1] = '\0'; + n_tokens = rte_strsplit( &name[sizeof("pipe")], strnlen(name, CFG_NAME_LEN), -- 2.1.4