From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D1ACA04C0; Fri, 9 Oct 2020 13:24:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 874601D508; Fri, 9 Oct 2020 13:22:35 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 727FF1D454; Fri, 9 Oct 2020 13:22:32 +0200 (CEST) IronPort-SDR: ycI6EARHOoFpfSiMIRBcis3sZhRmOgMe1qUndJq5kL8v7rLwW1RtHobmqIfmNPVsk1VtW3QbT+ FoNGfsKuAO0Q== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="250165515" X-IronPort-AV: E=Sophos;i="5.77,354,1596524400"; d="scan'208";a="250165515" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 04:22:30 -0700 IronPort-SDR: 2p0kJ1qJdilkhNanYm5+akN4HPQfyOs6y+tjKLb2lQwh/Ua1taZbNmn79MsaB8WGbrFrgqL0el 7OtYuCqO8f0A== X-IronPort-AV: E=Sophos;i="5.77,354,1596524400"; d="scan'208";a="343779579" Received: from rnicolau-mobl1.ger.corp.intel.com (HELO [10.252.17.210]) ([10.252.17.210]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 04:22:29 -0700 To: Bruce Richardson , dev@dpdk.org Cc: stable@dpdk.org, Stephen Hemminger , Anatoly Burakov References: <20200814110045.217724-1-bruce.richardson@intel.com> <20200821171017.50531-1-bruce.richardson@intel.com> <20200821171017.50531-4-bruce.richardson@intel.com> From: "Nicolau, Radu" Message-ID: Date: Fri, 9 Oct 2020 12:22:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20200821171017.50531-4-bruce.richardson@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [dpdk-dev] [PATCH v2 3/4] examples/mp_server: fix snprintf overflow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 8/21/2020 6:10 PM, Bruce Richardson wrote: > When producing a printable mac address the buffer was appropriately sized > for holding the mac address exactly, but the actual snprintf included a > '\n' character at the end, which means that the snprintf technically is > getting truncated i.e. the \n would not be added due to lack of space. > This gets flagged as a problem by modern versions of gcc, e.g. on Ubuntu > 20.04. > > main.c:77:37: warning: ‘__builtin___snprintf_chk’ output truncated before the last format character [-Wformat-truncation=] > 77 | "%02x:%02x:%02x:%02x:%02x:%02x\n", > | ^ > > Since the \n is getting stripped anyway, we can fix the issue by just > removing it. In the process we can switch to using the standard ethernet > address formating function from rte_ether.h. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > Cc: Stephen Hemminger > > Signed-off-by: Bruce Richardson > > --- > V2: switched code to use standard formatting function > --- Acked-by: Radu Nicolau