From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 6866F5947 for ; Fri, 27 Jun 2014 18:36:53 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 27 Jun 2014 09:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,561,1400050800"; d="scan'208";a="535137306" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 27 Jun 2014 09:36:13 -0700 Received: from irsmsx105.ger.corp.intel.com (163.33.3.28) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 27 Jun 2014 17:36:12 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.62]) by IRSMSX105.ger.corp.intel.com ([169.254.7.76]) with mapi id 14.03.0123.003; Fri, 27 Jun 2014 17:36:12 +0100 From: "Richardson, Bruce" To: Olivier MATZ , "De Lara Guarch, Pablo" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] string: fix potential seg fault on snprintf Thread-Index: AQHPkffZSBUcLHWCN0anEVr3ItQedJuEwZOAgAAMHACAAAXigIAAU5rA Date: Fri, 27 Jun 2014 16:36:12 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B02CF0DEA1@IRSMSX103.ger.corp.intel.com> References: <1403867097-18848-1-git-send-email-pablox.de.lara.guarch@intel.com> <53AD55BB.8090807@6wind.com> <53AD64D3.9000100@6wind.com> In-Reply-To: <53AD64D3.9000100@6wind.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] string: fix potential seg fault on snprintf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jun 2014 16:36:53 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier MATZ > Sent: Friday, June 27, 2014 5:34 AM > To: De Lara Guarch, Pablo; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] string: fix potential seg fault on snprin= tf >=20 > Hi Pablo, >=20 > On 06/27/2014 02:13 PM, De Lara Guarch, Pablo wrote: > > With last Thomas' patch, cmdline unit test does not pass due to this pr= oblem > (basically it tests this situation). > > After test passed, by fixing this issue in several functions, I looked = for other > places where this happened. >=20 > Indeed I missed the unit test, thanks. >=20 > I think that testing the NULL case is not required. To me, it is like > testing snprintf(NULL, ...) >=20 Famous last words include "that could never happen!" :-) Since this is not a performance critical piece of code, it does not hurt to= leave the Null-check in, and get the additional safety of checking for inv= alid inputs.