From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 380CB806D for ; Wed, 3 Dec 2014 17:05:16 +0100 (CET) Received: by mail-wg0-f46.google.com with SMTP id a1so12135124wgh.33 for ; Wed, 03 Dec 2014 08:05:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=HXH8TIGkeh+9NjYp2ny4/grSi6eVizOREMdGUpjBaV0=; b=kM1BFkn61VE4tr+FBFQPVk7YN8K1BfkzxIlfUqbycr9orLzzsY3qnyYiS8Jt1Idnxd 0jNHzUYsXuYEpCTVfQjnsafmx+xF4nHo2FrLiiQBO/9PwsovnJJ0ZhW2ZPtYTb1oliCT YaOe9U6No3UP6FdqFbl4d6bCC0PYA38RmeAeW7Wt53h3HKipH5JCcIqLNM1SBdGX1hsg 9iyrgPe26H/xNtYpw2j51ZDlqjhaD41SGiNBtxKooxYL6gJgWx/VXDxXnGPfqZn79IDm Hlj5TJ0VtdY256Ulq9og296H7cDFhwcyGMmWYUsv6Z1vxhnO6WSoudOjbynGLSqDNbS2 xUQQ== X-Gm-Message-State: ALoCoQnCAvT6OAz+1qo7tZdbu8Z8Rm1LtYR59btfPBcqjLkH3XG71T5JS39tHdfXqOP0dDTk+aJL X-Received: by 10.180.23.98 with SMTP id l2mr14400131wif.51.1417622714976; Wed, 03 Dec 2014 08:05:14 -0800 (PST) Received: from [10.16.0.195] (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id u9sm36838313wjy.37.2014.12.03.08.05.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 08:05:14 -0800 (PST) Message-ID: <547F34B9.7090400@6wind.com> Date: Wed, 03 Dec 2014 17:05:13 +0100 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: "Carew, Alan" , "dev@dpdk.org" References: <1413818593-26269-1-git-send-email-alan.carew@intel.com> <0E29434AEE0C3A4180987AB476A6F6306D281C01@IRSMSX109.ger.corp.intel.com> <544E0CF2.8090408@6wind.com> In-Reply-To: <544E0CF2.8090408@6wind.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] librte_cmdline: FreeBSD Fix oveflow when size of command result structure is greater than BUFSIZ 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: Wed, 03 Dec 2014 16:05:16 -0000 Hi, On 10/27/2014 10:14 AM, Olivier MATZ wrote: > Hello Alan, > > On 10/20/2014 05:26 PM, Carew, Alan wrote: >> A comment on my own patch. >> >> Making the size of result_buf consistent across each OS and keeping it as large >> as the Linux BUFSIZ(8192) doesn't really address the core issue. >> >> In the event that a user of librte_cmdline creates a custom context with a >> result structure > 8192 bytes then this problem will occur again, though >> somewhat unlikely, as the minimum number of the largest type would be 64 x >> cmdline_fixed_string_t types within a result structure, at its current size. >> >> There is no checking of overflow, I would be tempted to add a runtime check in >> cmdline_parse()/match_inst(), however I would be more comfortable with a build >> time check for this type of problem. >> >> Due to the opaque handling of user defined contexts there is no obvious way to >> do this at build time. >> >> Thoughts? > > Indeed, your patch does not address the core issue of the problem, > altough it's already an improvement to the current situation. > > Your issue was already fixed in the latest libcmdline library by > this patch (which also includes the replacement of BUFSIZ): > http://git.droids-corp.org/?p=libcmdline.git;a=commitdiff;h=b1d5b169352e57df3fc14c51ffad4b83f3e5613f > > I'm pretty sure it won't apply smoothly on the dpdk command line > library but it can probably be adapted. Ideally, the latest libcmdline > library should be [cleaned first and] merged in dpdk.org. Sorry, I had no time to deeply check this. I think your patch can go in 1.8 as it's still an enhancement compared to the current situation. We may go back on this later. Acked-by: Olivier Matz