From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id 9D5CF7F58 for ; Wed, 3 Dec 2014 19:13:13 +0100 (CET) Received: by mail-wg0-f45.google.com with SMTP id b13so20662501wgh.32 for ; Wed, 03 Dec 2014 10:13:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=prfN/kb1MNd1Hp/hcn3PSCEUETb06TsOt4xmuEmSjz0=; b=do5hOdRh1RUR2LukWZBNhHAYTcluimhFq5epGGxzQVrS9HaHIiB2i3O2nQtRxvwCw8 lpH/P2G2O08iQRJ3Pd97z/B5l4qoRcpY4S/ZAkwV+Pr/LRAdqU6abppJdrdcOIXVHPHF ZHnVEwMCfIWwMZY/WXlvutW5Z22lD0Rg0fJCqgkr/nT5UKbL3hnGSwgCkE9VfuEDNbPv p0EpJBxB55tbgqVB2+xEeusvdgMetnw9t9LgnKSRmstd7aw7pgHebKNNh0UMNYAJhWYL /NrbhBB76PDYOXdW95D0PU52XGG/XyUigYD74UP8MVrQSQBUJ6xyK+BLCbYmvIFMQnNj O+Gw== X-Gm-Message-State: ALoCoQm5Uin62sYgLzg57jc2PKnSC1FR3eg72IoPyfMqAjv/Onculw3uIlWhAMiuQ+fNy2wVzDWk X-Received: by 10.194.176.100 with SMTP id ch4mr9424449wjc.101.1417630393476; Wed, 03 Dec 2014 10:13:13 -0800 (PST) Received: from xps13.localnet (112.26.90.92.rev.sfr.net. [92.90.26.112]) by mx.google.com with ESMTPSA id bs2sm20083854wjc.43.2014.12.03.10.13.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Dec 2014 10:13:12 -0800 (PST) From: Thomas Monjalon To: "Carew, Alan" Date: Wed, 03 Dec 2014 19:12:32 +0100 Message-ID: <1507264.Zu5HfbIg9Y@xps13> Organization: 6WIND User-Agent: KMail/4.14.3 (Linux/3.17.4-1-ARCH; KDE/4.14.3; x86_64; ; ) In-Reply-To: <547F34B9.7090400@6wind.com> References: <1413818593-26269-1-git-send-email-alan.carew@intel.com> <544E0CF2.8090408@6wind.com> <547F34B9.7090400@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org 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 18:13:13 -0000 2014-12-03 17:05, Olivier MATZ: > 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 Applied Thanks -- Thomas