From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id 802C71B891 for ; Tue, 15 May 2018 15:53:47 +0200 (CEST) Received: by mail-wm0-f45.google.com with SMTP id f8-v6so1276556wmc.4 for ; Tue, 15 May 2018 06:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mSGb7lVn8N7PlVIT5Qnt0Hd2i7s62peajN52zhmxhvI=; b=MEfJWiVYognNgA9P9hV6bWvilzORxUXdZK3fvcNapuWWtkll0hrkV3jvMvPBCP+ujS wHsW8mCmninTLiOSliQ0g/wB56tFgN8iLzInzVRoqXaLxqDf5AWPmPegU9eurn1VDJYS zPFShCZLjJd3D9Bwj/84vhQEoyqY99nByJEfJqH9nzuhIL7QBcGfqufwnxI5rtCHjvSO RoEfP9yZj2XdDQVsphFXkDvuc641nIXd8UAK2r3otOWXTy6EyjBenA8S3g5+v5BYVn+G RCP91/hlZWAgpDBCMGBO1gL/xqBwPTRYNVKQ0jvn50Q9iU0tvsbswS2nUh+139X3MHgw Pg6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mSGb7lVn8N7PlVIT5Qnt0Hd2i7s62peajN52zhmxhvI=; b=VJKnZ204h8d2gAZYpHzTNbdVFUl0gRP0J/PcF3vyZ76bN9VgIfbJoh7dQ7J95qClmr xhOg6IFMpKK46k6LWVXDpwq4Qk947wniLqBR/H8cdTHDd1+43EEf/mT7AXvovJP2/4Uu RCl0d8l64bRCjMqQbJEr6fxcaqJSww37aPahVR7Omil+NGJYCWecGD0wPbo6Q+dtER7B W9ant2sRXelUWkxhiKuN1Au/paQGO/04iHJW0BY9hMc2KkXxgd889KP5xakmEoiIC8xX uLhlnkG+q2pue0LN7TekNo/fdyC1jDKO0yU9AyKAf6RNO/n20GWY0toAWn6IvKeFPNqp jD0g== X-Gm-Message-State: ALKqPwfv/GT46trrtkrw27xsToTJFfgR0tBuYpeVW6uKXMGDE4VbrzlX rmki5/QRrtYuU2/Wj4dsLXk4AqoLDAI= X-Google-Smtp-Source: AB8JxZphvQBqwHn4JQb6eweHKgy0ofKNbFWO8niuT7W3cOQSVmi9g66LF36XiaUfZ2zNeyjYsDht9g== X-Received: by 2002:a1c:cb88:: with SMTP id b130-v6mr8507745wmg.78.1526392427016; Tue, 15 May 2018 06:53:47 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id h67-v6sm452808wmg.41.2018.05.15.06.53.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 06:53:46 -0700 (PDT) From: luca.boccassi@gmail.com To: Andy Green Cc: Ferruh Yigit , dpdk stable Date: Tue, 15 May 2018 14:53:33 +0100 Message-Id: <20180515135335.10459-6-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515135335.10459-1-luca.boccassi@gmail.com> References: <20180515134731.9337-72-luca.boccassi@gmail.com> <20180515135335.10459-1-luca.boccassi@gmail.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 stable release 18.02.2 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: Tue, 15 May 2018 13:53:47 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/16/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 11e7cf319cb528aa77bbea28acdf07d1f1bb0cc2 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 115df9d96..5ccf7ad94 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -488,14 +488,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.14.2