From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail5.wrs.com (mail5.windriver.com [192.103.53.11]) by dpdk.org (Postfix) with ESMTP id 8E8532B8C for ; Thu, 9 Mar 2017 16:16:03 +0100 (CET) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id v29FG1Pb008312 (version=TLSv1 cipher=AES128-SHA bits=128 verify=OK); Thu, 9 Mar 2017 07:16:02 -0800 Received: from ALA-MBC.corp.ad.wrs.com ([fe80::fcbe:9b7:1141:89a1]) by ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) with mapi id 14.03.0294.000; Thu, 9 Mar 2017 07:16:01 -0800 From: "Legacy, Allain" To: "WILES, ROGER" CC: "RICHARDSON, BRUCE" , "DUMITRESCU, CRISTIAN FLORIN" , "dev@dpdk.org" , "Jolliffe, Ian" Thread-Topic: [dpdk-dev] [PATCH 5/5] cfgfile: increase local buffer size for max name and value Thread-Index: AQHSk4ujU8n7SW57f0ikMyaP6AUIe6GNFhuA//+R5UA= Date: Thu, 9 Mar 2017 15:16:01 +0000 Message-ID: <70A7408C6E1BFB41B192A929744D8523968E9F02@ALA-MBC.corp.ad.wrs.com> References: <1488482971-170522-1-git-send-email-allain.legacy@windriver.com> <1488482971-170522-6-git-send-email-allain.legacy@windriver.com> <8258C19A-889A-475B-9F29-33949ABCF8EE@intel.com> In-Reply-To: <8258C19A-889A-475B-9F29-33949ABCF8EE@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [128.224.140.166] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 5/5] cfgfile: increase local buffer size for max name and value 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: Thu, 09 Mar 2017 15:16:04 -0000 > -----Original Message----- > From: Wiles, Keith [mailto:keith.wiles@intel.com] > Sent: Thursday, March 09, 2017 8:46 AM > Would this change still cause a failure and memory over write if the user > decides to have very large string. Does the code check the lengths to mak= e > sure they are valid and return error? >=20 The fgets() is bounded by the size of the buffer and the subsequent validat= ion will raise an error if no newline was detected within the buffer theref= ore an overly long line will result in a failure. I have added a test case= in the v2 patchset in which I have added a unit test framework for this li= brary. while (fgets(buffer, sizeof(buffer), f) !=3D NULL) { char *pos =3D NULL; size_t len =3D strnlen(buffer, sizeof(buffer)); lineno++; if ((len >=3D sizeof(buffer) - 1) && (buffer[len-1] !=3D '\n')) { printf("Error line %d - no \\n found on string. " "Check if line too long\n", lineno); goto error1; } Does that satisfy your concern and qualify for you Ack?