From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D130F1B57C; Fri, 22 Mar 2019 09:02:21 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2M7tPJZ015257; Fri, 22 Mar 2019 01:02:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=mGdrbtoJS+YCySuIsbL3/szW2BZA7mwt3ozzKMKCe5I=; b=rT28Jinu5/L7STi/3gSJNaIaMJAXUETShvkJKvdDWh/jbd/jdQX+7xqjzAo42TBL8yWd K2Z7FF0ASTKkGLq/Wy0eGNFIyFytAIaxuv8mNrGRwOJwjamRHn/W7bIeNlTraOua4PIl jVZldCKlYzaDBNTDY1W4DeFQc/NtAupG5pa8F+Ul1FdDCuNVl0I6bBnHIlhC5vQQd5lM g3yD+/Qz4o6kyKn//LFC2za+oF3YrWBUqgOzJ4i/HmHyotsTJVbXkkG0GSea56AAkqd6 SA2Xij/JI5C4ZbUk2AJj6yD/r2uOWivyZD+TiUtBmDSLbBx5NivCB7glSiNBTq4OdxLI 9Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2rcetasstk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 22 Mar 2019 01:02:20 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 22 Mar 2019 01:02:09 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.57) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 22 Mar 2019 01:02:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mGdrbtoJS+YCySuIsbL3/szW2BZA7mwt3ozzKMKCe5I=; b=QMfE/6xA9Gn8heq9TogcytR1vIRJBxgkxUAsK9E6IORzbMm6brsYVFyRUpOFJbP3T5+CZA45V6x9VlKkEiJW7qqqxgvizEN95XaUTVU7lDbasNhqLRO8kfpoMOfL2mxZ583jNzHDKC0QDtLdZqBdIgiayVOfUZYBlq3F7fWatBs= Received: from BYAPR18MB2696.namprd18.prod.outlook.com (20.178.207.225) by BYAPR18MB2358.namprd18.prod.outlook.com (20.179.90.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Fri, 22 Mar 2019 08:02:07 +0000 Received: from BYAPR18MB2696.namprd18.prod.outlook.com ([fe80::9d0f:7018:e40c:db54]) by BYAPR18MB2696.namprd18.prod.outlook.com ([fe80::9d0f:7018:e40c:db54%5]) with mapi id 15.20.1730.013; Fri, 22 Mar 2019 08:02:07 +0000 From: Shahed Shaikh To: Chaitanya Babu Talluri , "dev@dpdk.org" CC: "reshma.pattan@intel.com" , "jananeex.m.parthasarathy@intel.com" , Rasesh Mody , "beilei.xing@intel.com" , "qi.z.zhang@intel.com" , "stable@dpdk.org" Thread-Topic: [EXT] [PATCH v8] drivers/net: fix possible overflow using strlcat Thread-Index: AQHU4IRbu5ETPh7OIkutsj4MOnrpiqYXSW5w Date: Fri, 22 Mar 2019 08:02:07 +0000 Message-ID: References: <1552912870-3526-1-git-send-email-tallurix.chaitanya.babu@intel.com> <1553241102-3265-1-git-send-email-tallurix.chaitanya.babu@intel.com> In-Reply-To: <1553241102-3265-1-git-send-email-tallurix.chaitanya.babu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [114.143.185.87] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5bb84576-fa2c-4328-1f82-08d6ae9cadf8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR18MB2358; x-ms-traffictypediagnostic: BYAPR18MB2358: x-microsoft-antispam-prvs: x-forefront-prvs: 09840A4839 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39850400004)(366004)(376002)(346002)(136003)(396003)(189003)(199004)(13464003)(76176011)(2501003)(66066001)(6116002)(14444005)(105586002)(256004)(186003)(74316002)(3846002)(9686003)(106356001)(102836004)(52536014)(6246003)(14454004)(26005)(305945005)(54906003)(8936002)(53546011)(7696005)(6506007)(6436002)(86362001)(5660300002)(478600001)(7736002)(99286004)(110136005)(81156014)(2906002)(229853002)(81166006)(53936002)(25786009)(68736007)(486006)(71190400001)(476003)(71200400001)(316002)(8676002)(55016002)(33656002)(97736004)(11346002)(4326008)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2358; H:BYAPR18MB2696.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hEAPUehi5KNhekMlKuZ2ZeKnZvLKhCUjbp9P7djaCjp5Z/QjHwEkPfYpN1etMxtSpYGc7VeYIGg/d6FbJv/6YDAW9MPgKp36X6mvSbSfz6h+BXFzQTl8W2qhMcZuctHbtVGtx3ZqGoZ5gWzl4sj8DDWdzIVUBV53p9Ktc5MieUg57XUReUoW29RZq4YtslHGF14mh/6Lit2iAZQef3EZwmEMWBcBe7ACVybWQ0lY9ma9qmS9QCoaEQf1fgd+agbGHR5f1AingI4YC4pD6dedYHLhBq8MEYxrvYnDSf9wAp7aV3BINdkUCEdMErY3vjy0hbumpLxnD08z2Orv+k8s9/R26dm/2EPJ6OIur2lJ3LcDeqjE5kZDTLpDFlqprtELnxAwAlFfFD6x7jiLuQwVDpyN6OE7HXecdvufqR/bJRM= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5bb84576-fa2c-4328-1f82-08d6ae9cadf8 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Mar 2019 08:02:07.1601 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2358 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-22_05:, , signatures=0 Subject: Re: [dpdk-dev] [EXT] [PATCH v8] drivers/net: fix possible overflow using strlcat 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: , X-List-Received-Date: Fri, 22 Mar 2019 08:02:22 -0000 > -----Original Message----- > From: Chaitanya Babu Talluri > Sent: Friday, March 22, 2019 1:22 PM > To: dev@dpdk.org > Cc: reshma.pattan@intel.com; jananeex.m.parthasarathy@intel.com; Rasesh > Mody ; Shahed Shaikh ; > beilei.xing@intel.com; qi.z.zhang@intel.com; Chaitanya Babu Talluri > ; stable@dpdk.org > Subject: [EXT] [PATCH v8] drivers/net: fix possible overflow using strlca= t >=20 > strcat does not check the destination length and there might be chances o= f > string overflow so instead of strcat, strlcat is used. >=20 > Fixes: 540a211084 ("bnx2x: driver core") > Fixes: e163c18a15 ("net/i40e: update ptype and pctype info") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chaitanya Babu Talluri > --- > v8: Added missing semi-colon. > v7: Corrected title. > v6: Updated title. > v5: Removed strcat. > v4: Corrected usage of strlcat. > v3: Instead of strncat, used strlcat. > v2: Instead of strncat, used snprintf. > --- > drivers/net/bnx2x/bnx2x.c | 5 +++-- > drivers/net/i40e/i40e_ethdev.c | 4 ++-- > 2 files changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index > 26b3828e8..ab092e23f 100644 > --- a/drivers/net/bnx2x/bnx2x.c > +++ b/drivers/net/bnx2x/bnx2x.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include >=20 > #define BNX2X_PMD_VER_PREFIX "BNX2X PMD" > #define BNX2X_PMD_VERSION_MAJOR 1 > @@ -11741,13 +11742,13 @@ static const char *get_bnx2x_flags(uint32_t > flags) >=20 > for (i =3D 0; i < 5; i++) > if (flags & (1 << i)) { > - strcat(flag_str, flag[i]); > + strlcat(flag_str, flag[i], sizeof(flag_str)); > flags ^=3D (1 << i); > } > if (flags) { > static char unknown[BNX2X_INFO_STR_MAX]; > snprintf(unknown, 32, "Unknown flag mask %x", flags); > - strcat(flag_str, unknown); > + strlcat(flag_str, unknown, sizeof(flag_str)); > } > return flag_str; > } For bnx2x PMD changes - Acked-by: Shahed Shaikh Thanks, Shahed=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 13706A00E6 for ; Fri, 22 Mar 2019 09:02:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B36991B57F; Fri, 22 Mar 2019 09:02:23 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D130F1B57C; Fri, 22 Mar 2019 09:02:21 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2M7tPJZ015257; Fri, 22 Mar 2019 01:02:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=mGdrbtoJS+YCySuIsbL3/szW2BZA7mwt3ozzKMKCe5I=; b=rT28Jinu5/L7STi/3gSJNaIaMJAXUETShvkJKvdDWh/jbd/jdQX+7xqjzAo42TBL8yWd K2Z7FF0ASTKkGLq/Wy0eGNFIyFytAIaxuv8mNrGRwOJwjamRHn/W7bIeNlTraOua4PIl jVZldCKlYzaDBNTDY1W4DeFQc/NtAupG5pa8F+Ul1FdDCuNVl0I6bBnHIlhC5vQQd5lM g3yD+/Qz4o6kyKn//LFC2za+oF3YrWBUqgOzJ4i/HmHyotsTJVbXkkG0GSea56AAkqd6 SA2Xij/JI5C4ZbUk2AJj6yD/r2uOWivyZD+TiUtBmDSLbBx5NivCB7glSiNBTq4OdxLI 9Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2rcetasstk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 22 Mar 2019 01:02:20 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 22 Mar 2019 01:02:09 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.57) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 22 Mar 2019 01:02:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mGdrbtoJS+YCySuIsbL3/szW2BZA7mwt3ozzKMKCe5I=; b=QMfE/6xA9Gn8heq9TogcytR1vIRJBxgkxUAsK9E6IORzbMm6brsYVFyRUpOFJbP3T5+CZA45V6x9VlKkEiJW7qqqxgvizEN95XaUTVU7lDbasNhqLRO8kfpoMOfL2mxZ583jNzHDKC0QDtLdZqBdIgiayVOfUZYBlq3F7fWatBs= Received: from BYAPR18MB2696.namprd18.prod.outlook.com (20.178.207.225) by BYAPR18MB2358.namprd18.prod.outlook.com (20.179.90.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Fri, 22 Mar 2019 08:02:07 +0000 Received: from BYAPR18MB2696.namprd18.prod.outlook.com ([fe80::9d0f:7018:e40c:db54]) by BYAPR18MB2696.namprd18.prod.outlook.com ([fe80::9d0f:7018:e40c:db54%5]) with mapi id 15.20.1730.013; Fri, 22 Mar 2019 08:02:07 +0000 From: Shahed Shaikh To: Chaitanya Babu Talluri , "dev@dpdk.org" CC: "reshma.pattan@intel.com" , "jananeex.m.parthasarathy@intel.com" , Rasesh Mody , "beilei.xing@intel.com" , "qi.z.zhang@intel.com" , "stable@dpdk.org" Thread-Topic: [EXT] [PATCH v8] drivers/net: fix possible overflow using strlcat Thread-Index: AQHU4IRbu5ETPh7OIkutsj4MOnrpiqYXSW5w Date: Fri, 22 Mar 2019 08:02:07 +0000 Message-ID: References: <1552912870-3526-1-git-send-email-tallurix.chaitanya.babu@intel.com> <1553241102-3265-1-git-send-email-tallurix.chaitanya.babu@intel.com> In-Reply-To: <1553241102-3265-1-git-send-email-tallurix.chaitanya.babu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [114.143.185.87] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5bb84576-fa2c-4328-1f82-08d6ae9cadf8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR18MB2358; x-ms-traffictypediagnostic: BYAPR18MB2358: x-microsoft-antispam-prvs: x-forefront-prvs: 09840A4839 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39850400004)(366004)(376002)(346002)(136003)(396003)(189003)(199004)(13464003)(76176011)(2501003)(66066001)(6116002)(14444005)(105586002)(256004)(186003)(74316002)(3846002)(9686003)(106356001)(102836004)(52536014)(6246003)(14454004)(26005)(305945005)(54906003)(8936002)(53546011)(7696005)(6506007)(6436002)(86362001)(5660300002)(478600001)(7736002)(99286004)(110136005)(81156014)(2906002)(229853002)(81166006)(53936002)(25786009)(68736007)(486006)(71190400001)(476003)(71200400001)(316002)(8676002)(55016002)(33656002)(97736004)(11346002)(4326008)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2358; H:BYAPR18MB2696.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hEAPUehi5KNhekMlKuZ2ZeKnZvLKhCUjbp9P7djaCjp5Z/QjHwEkPfYpN1etMxtSpYGc7VeYIGg/d6FbJv/6YDAW9MPgKp36X6mvSbSfz6h+BXFzQTl8W2qhMcZuctHbtVGtx3ZqGoZ5gWzl4sj8DDWdzIVUBV53p9Ktc5MieUg57XUReUoW29RZq4YtslHGF14mh/6Lit2iAZQef3EZwmEMWBcBe7ACVybWQ0lY9ma9qmS9QCoaEQf1fgd+agbGHR5f1AingI4YC4pD6dedYHLhBq8MEYxrvYnDSf9wAp7aV3BINdkUCEdMErY3vjy0hbumpLxnD08z2Orv+k8s9/R26dm/2EPJ6OIur2lJ3LcDeqjE5kZDTLpDFlqprtELnxAwAlFfFD6x7jiLuQwVDpyN6OE7HXecdvufqR/bJRM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5bb84576-fa2c-4328-1f82-08d6ae9cadf8 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Mar 2019 08:02:07.1601 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2358 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-22_05:, , signatures=0 Subject: Re: [dpdk-dev] [EXT] [PATCH v8] drivers/net: fix possible overflow using strlcat 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" Message-ID: <20190322080207.QUkjpLFHkLU_GkyTYX07XyWWMGdxRSTHmJ9HvwhUxHo@z> > -----Original Message----- > From: Chaitanya Babu Talluri > Sent: Friday, March 22, 2019 1:22 PM > To: dev@dpdk.org > Cc: reshma.pattan@intel.com; jananeex.m.parthasarathy@intel.com; Rasesh > Mody ; Shahed Shaikh ; > beilei.xing@intel.com; qi.z.zhang@intel.com; Chaitanya Babu Talluri > ; stable@dpdk.org > Subject: [EXT] [PATCH v8] drivers/net: fix possible overflow using strlca= t >=20 > strcat does not check the destination length and there might be chances o= f > string overflow so instead of strcat, strlcat is used. >=20 > Fixes: 540a211084 ("bnx2x: driver core") > Fixes: e163c18a15 ("net/i40e: update ptype and pctype info") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chaitanya Babu Talluri > --- > v8: Added missing semi-colon. > v7: Corrected title. > v6: Updated title. > v5: Removed strcat. > v4: Corrected usage of strlcat. > v3: Instead of strncat, used strlcat. > v2: Instead of strncat, used snprintf. > --- > drivers/net/bnx2x/bnx2x.c | 5 +++-- > drivers/net/i40e/i40e_ethdev.c | 4 ++-- > 2 files changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index > 26b3828e8..ab092e23f 100644 > --- a/drivers/net/bnx2x/bnx2x.c > +++ b/drivers/net/bnx2x/bnx2x.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include >=20 > #define BNX2X_PMD_VER_PREFIX "BNX2X PMD" > #define BNX2X_PMD_VERSION_MAJOR 1 > @@ -11741,13 +11742,13 @@ static const char *get_bnx2x_flags(uint32_t > flags) >=20 > for (i =3D 0; i < 5; i++) > if (flags & (1 << i)) { > - strcat(flag_str, flag[i]); > + strlcat(flag_str, flag[i], sizeof(flag_str)); > flags ^=3D (1 << i); > } > if (flags) { > static char unknown[BNX2X_INFO_STR_MAX]; > snprintf(unknown, 32, "Unknown flag mask %x", flags); > - strcat(flag_str, unknown); > + strlcat(flag_str, unknown, sizeof(flag_str)); > } > return flag_str; > } For bnx2x PMD changes - Acked-by: Shahed Shaikh Thanks, Shahed=20