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 7EBA9A04AF for ; Fri, 14 Aug 2020 17:01:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 688671C0D8; Fri, 14 Aug 2020 17:01:23 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 6CBC71C0CE for ; Fri, 14 Aug 2020 17:01:20 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id k13so4283829plk.13 for ; Fri, 14 Aug 2020 08:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Do6xTsWQg70vnrR09H/I5pVLFVHIcL6ET9aD3EifBTA=; b=AWz0+fxf4AP1NOO0DsjuJ5A2LSO69i9kSQW8QIVr0Fcv1kKLU95w00uMIVR2/zAXIG 2Bq+XFbyqMmbetpEKn6XwmGrrOZml4GA7E1u4+v4MChtofBXq494d+vq/mKkmjg67m+C O7f5Id72RYy9CvV2PMBa01BebiL3UwzxGOHGTpKSEDfF5Dh45eK8h8nsYDsVCHrREy9/ MeYgoR1OErqzoR/AxS9TE9Ak8BrioekhO5OdR1ud4RoQoBP47x7boHGl2+h/+1tbXKBP LrV3b9SFpa80RlnDEmy6ZjJwAdrzhKS3++TlXdSMtu+V03Iavql32B2fbuI/vFRvYJR0 pGuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Do6xTsWQg70vnrR09H/I5pVLFVHIcL6ET9aD3EifBTA=; b=jVdbjvG4Q/lHlQObw6qs7VR5rIBgCAcYAPRJeNgzLbfaDVO0J9vQDB2VqzrvPOlma4 uGIQRGe7R94ZdWirVEd0ZdoWggWsWK0c8DKOVvplzBwEaI7jKwmtImFZ5C73czJfwYWK QpkAZbaicLt2yeNDlic8GC1Bw9yPqDEIgKOhCxxn6tFD+9wAcPXrBKV0z8k44Pztyy6Y UC+8xfCApkPIrLmb1y4qegfZC8P7DbmFOdvkcbK/GCG9CKCrNTAjU0K1HNvNve1F3jhO wBj8JE0ywtf3xnAhLmq1eLYkNMfFiYZbq0dE2sI8xo0LODUTpKQAHQKZHDFhuKRQXXgP gA0g== X-Gm-Message-State: AOAM531mLnrqgCAKdIAN3DeEvdYoC5muCViTV6gMlXXPzeir3Wsqp0M5 j3QPwRAnDzV23EY9HcfCflWw9Q== X-Google-Smtp-Source: ABdhPJzQqQz7PvHnmiK6yl8cKt47plJi6CDXzfWj2+NZCG1FbgocJNyDRT4CG5mvCvgtKtZhmKylFw== X-Received: by 2002:a17:90a:fe83:: with SMTP id co3mr2592258pjb.64.1597417279453; Fri, 14 Aug 2020 08:01:19 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d23sm4300892pgm.11.2020.08.14.08.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 08:01:19 -0700 (PDT) Date: Fri, 14 Aug 2020 08:01:16 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org, stable@dpdk.org, Anatoly Burakov Message-ID: <20200814080116.37da0f89@hermes.lan> In-Reply-To: <20200814110045.217724-4-bruce.richardson@intel.com> References: <20200814110045.217724-1-bruce.richardson@intel.com> <20200814110045.217724-4-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 3/4] examples/mp_server: fix snprintf overflow 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Fri, 14 Aug 2020 12:00:44 +0100 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. >=20 > main.c:77:37: warning: =E2=80=98__builtin___snprintf_chk=E2=80=99 output = truncated before the last format character [-Wformat-truncation=3D] > 77 | "%02x:%02x:%02x:%02x:%02x:%02x\n", > | ^ >=20 > Since the \n is getting stripped anyway, we can fix the issue by just > removing it from the printf string. >=20 > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org >=20 > Signed-off-by: Bruce Richardson > --- > examples/multi_process/client_server_mp/mp_server/main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/e= xamples/multi_process/client_server_mp/mp_server/main.c > index 280dab8672..af5af672c3 100644 > --- a/examples/multi_process/client_server_mp/mp_server/main.c > +++ b/examples/multi_process/client_server_mp/mp_server/main.c > @@ -74,7 +74,7 @@ get_printable_mac_addr(uint16_t port) > return err_address; > } > snprintf(addresses[port], sizeof(addresses[port]), > - "%02x:%02x:%02x:%02x:%02x:%02x\n", > + "%02x:%02x:%02x:%02x:%02x:%02x", > mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2], > mac.addr_bytes[3], mac.addr_bytes[4], mac.addr_bytes[5]); > } Please convert to rte_ether_format_addr() instead of local hard coded forma= t.