From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 496ED2BF4 for ; Thu, 3 Jan 2019 09:14:53 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Jan 2019 10:14:47 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x038EJfi008603; Thu, 3 Jan 2019 10:14:46 +0200 From: Yongseok Koh To: Andy Green Cc: Ferruh Yigit , dpdk stable Date: Thu, 3 Jan 2019 00:13:38 -0800 Message-Id: <20190103081400.14191-15-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190103081400.14191-1-yskoh@mellanox.com> References: <20190103081400.14191-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app/procinfo: fix sprintf overrun' has been queued to LTS release 17.11.5 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2019 08:14:53 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/04/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Yongseok --- >>From a115124be053c3475e0ee16861c98f00965070a0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 14 May 2018 13:01:02 +0800 Subject: [PATCH] app/procinfo: fix sprintf overrun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 3cef37eb98769935fbc12e01f06d9ac36d430071 ] app/proc-info/main.c: In function ‘nic_xstats_display’: app/proc-info/main.c:495:45: error: ‘%s’ directive writing up to 255 bytes into a regioni of size between 165 and 232 [-Werror=format-overflow=] sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%" ^~ PRIu64"\n", host_id, port_id, counter_type, ~~~~~~~~~~~~ app/proc-info/main.c:495:4: note: ‘sprintf’ output between 31 and 435 bytes into a destination of size 256 sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRIu64"\n", host_id, port_id, counter_type, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xstats_names[i].name, values[i]); Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id") Signed-off-by: Andy Green Reviewed-by: Ferruh Yigit --- app/proc_info/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 875d91ea3..2893bec69 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -517,14 +517,18 @@ nic_xstats_display(uint16_t port_id) if (enable_collectd_format) { char counter_type[MAX_STRING_LEN]; char buf[MAX_STRING_LEN]; + size_t n; collectd_resolve_cnt_type(counter_type, sizeof(counter_type), xstats_names[i].name); - sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%" + n = snprintf(buf, MAX_STRING_LEN, + "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%" PRIu64"\n", host_id, port_id, counter_type, xstats_names[i].name, values[i]); - ret = write(stdout_fd, buf, strlen(buf)); + if (n > sizeof(buf) - 1) + n = sizeof(buf) - 1; + ret = write(stdout_fd, buf, n); if (ret < 0) goto err; } else { -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-02 23:59:12.900450583 -0800 +++ 0015-app-procinfo-fix-sprintf-overrun.patch 2019-01-02 23:59:12.054816000 -0800 @@ -1,4 +1,4 @@ -From 3cef37eb98769935fbc12e01f06d9ac36d430071 Mon Sep 17 00:00:00 2001 +From a115124be053c3475e0ee16861c98f00965070a0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 14 May 2018 13:01:02 +0800 Subject: [PATCH] app/procinfo: fix sprintf overrun @@ -6,6 +6,8 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +[ upstream commit 3cef37eb98769935fbc12e01f06d9ac36d430071 ] + app/proc-info/main.c: In function ‘nic_xstats_display’: app/proc-info/main.c:495:45: error: ‘%s’ directive writing up to 255 bytes into a regioni of size between 165 and 232 @@ -23,19 +25,18 @@ xstats_names[i].name, values[i]); Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id") -Cc: stable@dpdk.org Signed-off-by: Andy Green Reviewed-by: Ferruh Yigit --- - app/proc-info/main.c | 8 ++++++-- + app/proc_info/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -diff --git a/app/proc-info/main.c b/app/proc-info/main.c -index 539e13243..c20effa4f 100644 ---- a/app/proc-info/main.c -+++ b/app/proc-info/main.c -@@ -488,14 +488,18 @@ nic_xstats_display(uint16_t port_id) +diff --git a/app/proc_info/main.c b/app/proc_info/main.c +index 875d91ea3..2893bec69 100644 +--- a/app/proc_info/main.c ++++ b/app/proc_info/main.c +@@ -517,14 +517,18 @@ nic_xstats_display(uint16_t port_id) if (enable_collectd_format) { char counter_type[MAX_STRING_LEN]; char buf[MAX_STRING_LEN];