From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C61D74407E; Tue, 21 May 2024 03:01:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3042C40263; Tue, 21 May 2024 03:01:10 +0200 (CEST) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id D914E4021E for ; Tue, 21 May 2024 03:01:08 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ee7963db64so25282735ad.1 for ; Mon, 20 May 2024 18:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1716253268; x=1716858068; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UGfigz1HenfL1TDUA8+CMJuK5nro7iow/qV83WKImiQ=; b=LgCaQz0DhUrtg6UJH7Zc6OwgAcPsEm6I3QzvN9O0N/Jl67fQOBnKS5+ajqOVQkfDBl /0lY70NTqGqVFAY8+0/E6TSZoSibe+sM/aXhzkQJhFmFlXP9Pi5xx+fIKwV85YLK69eO 3VlxA0OWTJkwBu9IwaQb8YXcX25Iiz6k9c4ZZvIu5oRIrU9WoQ+JYMAcqGVrBaPv+cRS C+PtYuy3v6g81slC2paZ83Z1IuoTm+2QrYsVV/KLDOrW/4ramU0E4K0/4AM0X0KMXoDf pGsmko1h0tvCq1beDdWD5CC6OZdxMvytA8xK1rpoyMw00RG6Xw4mkVwAJjma6gIL08+z sK9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716253268; x=1716858068; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UGfigz1HenfL1TDUA8+CMJuK5nro7iow/qV83WKImiQ=; b=eSkLl9QgD27tNUVen+wz26V+sfFr8u+kCkpoicWFk2SbEvSI6EGjoyghH2dwS2MT8h dZh6XUTXa8usXTUmTpgJlFfngSo8YbxTgpNmb01wCM93U5CMTMzcevel4f8eaYg/7oyz GWS0piMSGFpXN9rs4z+roJJ9kgbDl2JZ53Jg1IdXQgh4ZWVbQPlUSR9kzjSGoSLhNQSc oc+xjOGTw/yF39kT8l5JgHoVQl8v1XTpkJt6xrl8S9iq6YN+9wvzdo0/bxbc6ytG1X1N yezROWasn27Qolvjd+sYrmt1453t+yQ7LCcZvATud/XbuzJenOgGa3JqvnoWwRivj7rr cR9Q== X-Gm-Message-State: AOJu0Yw1uWWR/o8wE4sOASoHE9ujw0X9P/BAlrEjwUp1lXCtQlDv8oNo VlEYpP9zjG/iOleCZQS1szRHntcmgrycJbJmTvPoeVtScbvrI93hT58WeoR7mutFFYL2hIa9GUh m4zs= X-Google-Smtp-Source: AGHT+IFxgyRkfig+Bve5s4j+bW2kTGGvT+5BVKQlLGHq67l9c2HMcwsLT9s8dZ/3Sim/pmRLEj+eKw== X-Received: by 2002:a17:902:e80b:b0:1f3:240:2553 with SMTP id d9443c01a7336-1f30240282cmr53919925ad.4.1716253267704; Mon, 20 May 2024 18:01:07 -0700 (PDT) Received: from hermes.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0bf32f51sm215179485ad.154.2024.05.20.18.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 18:01:07 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Reshma Pattan , Ray Kinsella Subject: [PATCH 1/2] pcapng: fix fortified memcpy warning Date: Mon, 20 May 2024 18:01:03 -0700 Message-ID: <20240521010105.81868-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When adding option with no data, the rte_pcapng_add_option would call memcpy with src of NULL and size of zero. This generates a warning if fortify is enabled. Bugzilla ID: 1446 Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files") Signed-off-by: Stephen Hemminger --- lib/pcapng/rte_pcapng.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c index f74ec939a9..7254defce7 100644 --- a/lib/pcapng/rte_pcapng.c +++ b/lib/pcapng/rte_pcapng.c @@ -128,7 +128,8 @@ pcapng_add_option(struct pcapng_option *popt, uint16_t code, { popt->code = code; popt->length = len; - memcpy(popt->data, data, len); + if (len > 0) + memcpy(popt->data, data, len); return (struct pcapng_option *)((uint8_t *)popt + pcapng_optlen(len)); } -- 2.43.0