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 77033A04F0 for ; Tue, 10 Dec 2019 16:01:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3F32D1BE9E; Tue, 10 Dec 2019 16:01:12 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id E25DC1BE82 for ; Tue, 10 Dec 2019 16:01:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575990070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qbIJcB1AHgfHePhgvqZVonHxcuUdR5ghlEgRT1R3WsA=; b=IzirTiVx4TT7uFaTT8yUSfSB5aQsEqA4Xju3hRG/YxwauE+sUrOhAt0N6MOAQbddLWj6ZC kGvfm2CjNk7WH78+wJsezk93LxiK2358TC2938Zop26EyeLg18Gm1Y4g3n4MQuSbwl5BNn 7c7upfrsiX8KmcLSoKv3u25VEiDRry0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-co1u1Pz9Op-RNQkj3J6nSA-1; Tue, 10 Dec 2019 10:01:07 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D407A91232; Tue, 10 Dec 2019 15:01:05 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 481255D9C5; Tue, 10 Dec 2019 15:01:04 +0000 (UTC) From: Kevin Traynor To: Ciara Power Cc: Reshma Pattan , Bruce Richardson , dpdk stable Date: Tue, 10 Dec 2019 14:59:14 +0000 Message-Id: <20191210145937.32755-40-ktraynor@redhat.com> In-Reply-To: <20191210145937.32755-1-ktraynor@redhat.com> References: <20191210145937.32755-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: co1u1Pz9Op-RNQkj3J6nSA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'app/procinfo: use strlcpy for copying string' has been queued to LTS release 18.11.6 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" Hi, FYI, your patch has been queued to LTS release 18.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/16/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. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/bc12c8f6136f2516e9= 8027be0e5e8a3df6f7c01a Thanks. Kevin. --- >From bc12c8f6136f2516e98027be0e5e8a3df6f7c01a Mon Sep 17 00:00:00 2001 From: Ciara Power Date: Thu, 26 Sep 2019 16:11:59 +0100 Subject: [PATCH] app/procinfo: use strlcpy for copying string [ upstream commit 7edbf7ddfd7d2453afaad3b72666491d30b616af ] Replaced strncpy and strcpy with strlcpy. Also replaced snprintf with strlcpy where applicable. Using strlcpy is safe practice when copying strings, as it will include a null terminator. Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id") Fixes: 8a37f37fc243 ("app/procinfo: add --show-port") Reported-by: Reshma Pattan Signed-off-by: Ciara Power Acked-by: Bruce Richardson --- app/proc-info/main.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index c20effa4f..248f0b2b0 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -168,5 +168,5 @@ proc_info_preparse_args(int argc, char **argv) =20 =09=09if (err) -=09=09=09strcpy(host_id, "unknown"); +=09=09=09strlcpy(host_id, "unknown", sizeof(host_id)); =09} =20 @@ -335,48 +335,48 @@ static void collectd_resolve_cnt_type(char *cnt_type,= size_t cnt_type_len, =09 (strncmp(cnt_name, "rx_", strlen("rx_")) =3D=3D 0)) { =09=09if (strncmp(type_end, "_errors", strlen("_errors")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_rx_errors", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_rx_errors", cnt_type_len); =09=09else if (strncmp(type_end, "_dropped", strlen("_dropped")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_rx_dropped", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_rx_dropped", cnt_type_len); =09=09else if (strncmp(type_end, "_bytes", strlen("_bytes")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_rx_octets", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_rx_octets", cnt_type_len); =09=09else if (strncmp(type_end, "_packets", strlen("_packets")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_rx_packets", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_rx_packets", cnt_type_len); =09=09else if (strncmp(type_end, "_placement", =09=09=09=09 strlen("_placement")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_rx_errors", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_rx_errors", cnt_type_len); =09=09else if (strncmp(type_end, "_buff", strlen("_buff")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_rx_errors", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_rx_errors", cnt_type_len); =09=09else =09=09=09/* Does not fit obvious type: use a more generic one */ -=09=09=09strncpy(cnt_type, "derive", cnt_type_len); +=09=09=09strlcpy(cnt_type, "derive", cnt_type_len); =09} else if ((type_end !=3D NULL) && =09=09(strncmp(cnt_name, "tx_", strlen("tx_"))) =3D=3D 0) { =09=09if (strncmp(type_end, "_errors", strlen("_errors")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_tx_errors", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_tx_errors", cnt_type_len); =09=09else if (strncmp(type_end, "_dropped", strlen("_dropped")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_tx_dropped", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_tx_dropped", cnt_type_len); =09=09else if (strncmp(type_end, "_bytes", strlen("_bytes")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_tx_octets", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_tx_octets", cnt_type_len); =09=09else if (strncmp(type_end, "_packets", strlen("_packets")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "if_tx_packets", cnt_type_len); +=09=09=09strlcpy(cnt_type, "if_tx_packets", cnt_type_len); =09=09else =09=09=09/* Does not fit obvious type: use a more generic one */ -=09=09=09strncpy(cnt_type, "derive", cnt_type_len); +=09=09=09strlcpy(cnt_type, "derive", cnt_type_len); =09} else if ((type_end !=3D NULL) && =09=09 (strncmp(cnt_name, "flow_", strlen("flow_"))) =3D=3D 0) { =09=09if (strncmp(type_end, "_filters", strlen("_filters")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "operations", cnt_type_len); +=09=09=09strlcpy(cnt_type, "operations", cnt_type_len); =09=09else if (strncmp(type_end, "_errors", strlen("_errors")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "errors", cnt_type_len); +=09=09=09strlcpy(cnt_type, "errors", cnt_type_len); =09=09else if (strncmp(type_end, "_filters", strlen("_filters")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "filter_result", cnt_type_len); +=09=09=09strlcpy(cnt_type, "filter_result", cnt_type_len); =09} else if ((type_end !=3D NULL) && =09=09 (strncmp(cnt_name, "mac_", strlen("mac_"))) =3D=3D 0) { =09=09if (strncmp(type_end, "_errors", strlen("_errors")) =3D=3D 0) -=09=09=09strncpy(cnt_type, "errors", cnt_type_len); +=09=09=09strlcpy(cnt_type, "errors", cnt_type_len); =09} else { =09=09/* Does not fit obvious type, or strrchr error: */ =09=09/* use a more generic type */ -=09=09strncpy(cnt_type, "derive", cnt_type_len); +=09=09strlcpy(cnt_type, "derive", cnt_type_len); =09} } --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-10 14:49:41.783104698 +0000 +++ 0040-app-procinfo-use-strlcpy-for-copying-string.patch=092019-12-10 14:= 49:39.071457413 +0000 @@ -1 +1 @@ -From 7edbf7ddfd7d2453afaad3b72666491d30b616af Mon Sep 17 00:00:00 2001 +From bc12c8f6136f2516e98027be0e5e8a3df6f7c01a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 7edbf7ddfd7d2453afaad3b72666491d30b616af ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -19,2 +20,2 @@ - app/proc-info/main.c | 38 +++++++++++++++++++------------------- - 1 file changed, 19 insertions(+), 19 deletions(-) + app/proc-info/main.c | 36 ++++++++++++++++++------------------ + 1 file changed, 18 insertions(+), 18 deletions(-) @@ -23 +24 @@ -index 8cf501d06..abeca4aab 100644 +index c20effa4f..248f0b2b0 100644 @@ -26 +27 @@ -@@ -204,5 +204,5 @@ proc_info_preparse_args(int argc, char **argv) +@@ -168,5 +168,5 @@ proc_info_preparse_args(int argc, char **argv) @@ -33 +34 @@ -@@ -399,48 +399,48 @@ static void collectd_resolve_cnt_type(char *cnt_type= , size_t cnt_type_len, +@@ -335,48 +335,48 @@ static void collectd_resolve_cnt_type(char *cnt_type= , size_t cnt_type_len, @@ -99,7 +99,0 @@ -@@ -1350,5 +1350,5 @@ main(int argc, char **argv) - =09=09printf("Error from rte_eal_cleanup(), %d\n", ret); -=20 --=09snprintf(bdr_str, MAX_STRING_LEN, " "); -+=09strlcpy(bdr_str, " ", MAX_STRING_LEN); - =09STATS_BDR_STR(50, bdr_str); -=20