From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by dpdk.org (Postfix) with ESMTP id 9404829C6 for ; Mon, 4 Apr 2016 17:57:36 +0200 (CEST) Received: by mail-lb0-f180.google.com with SMTP id qe11so167207721lbc.3 for ; Mon, 04 Apr 2016 08:57:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=UbwAeskNq1G4vQXqDOojp/pwzi5Svnmplzzcw/bzkGg=; b=ugJPlD3I9L0EEjvFunojF6JXz/hUlxHGMymS4mqKTHvNoG45VsJHGYymD2o21DlMS/ qpqd7zdv3U9P+YqrcS2ExHb9nKR28ClNvWxPkEwAkG7XaZBGlov4X2yC1ujI/4sCBJ7u 2/XaPaSt/z/9GpahAsVlyZ7QwfQO0x9Z0wQNdZeYyGckgup5GTCufMNfDwPZ3noUuAVZ MUKVqWER0ksKmh8jEweMbCISWRdWRkCtwrXbxXthqwy4tNKUlujDbyY0oMNc4u5J8Kzr u0i4o0I5ogVcth43JpX0KJW45vli8NUEFel/k1LTNwE76jkjY2BpOwAULb1TQ4mzr8kK /jCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=UbwAeskNq1G4vQXqDOojp/pwzi5Svnmplzzcw/bzkGg=; b=DFKQopK6apg7sTWLKrxDmjfXMkaqaaCFtC0Wqs+2P+MDMuQW4go4CbmEg422n5dlRy cdbqzagPFPSC+CNkMh20InpkBkuxKgIgFi/LWk6Opc2dCQYQ4nf1jCXWPWicTluH/K1+ 5yf9Qhr+qmLI9DG4dkW3OK+HovwQ5JdiWL52EsUxsM9k2VUyTMdBgMa2aZ20l84dJh1g bA6eeXMLjS5MkhFIGbLQXGgbBpGL/mBx2hRfg5oRa6o4+xn9l4VMzdhZtMlvS9rPdpTx EUPuI5grkNukmqk5ms9P+tzAUPLOOoFkQhrjHXIUR5rRWs5eteEc+2PZIL3GLPYSkKTF w4Ow== X-Gm-Message-State: AD7BkJIdW6XS/79k6oyv+aR5DnMrUmvkHhMj5Z17mFF8oWW6syDOFB4Uxy+70IpU7QU++fPr X-Received: by 10.28.150.195 with SMTP id y186mr12803190wmd.43.1459785455583; Mon, 04 Apr 2016 08:57:35 -0700 (PDT) Received: from [192.168.0.10] (was59-1-82-226-113-214.fbx.proxad.net. [82.226.113.214]) by smtp.gmail.com with ESMTPSA id j71sm3165964wmj.21.2016.04.04.08.57.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 04 Apr 2016 08:57:34 -0700 (PDT) To: "Azarewicz, PiotrX T" References: <1459510581-31392-1-git-send-email-piotrx.t.azarewicz@intel.com> <57021F2E.8070306@6wind.com> <4837007523CC9A4B9414D20C13DE6E6413687FDB@IRSMSX102.ger.corp.intel.com> Cc: "dev@dpdk.org" From: Olivier Matz Message-ID: <57028EED.9020008@6wind.com> Date: Mon, 4 Apr 2016 17:57:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <4837007523CC9A4B9414D20C13DE6E6413687FDB@IRSMSX102.ger.corp.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1 1/1] cmdline: add any multi string mode to token string 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: Mon, 04 Apr 2016 15:57:36 -0000 Hi Piotr, On 04/04/2016 04:11 PM, Azarewicz, PiotrX T wrote: >> Using token_len + 1 as the buffer size in the snprintf looks a bit dangerous, as >> it won't protect from overflows. >> >> See the following example: > > > That's why snprintf() should still use STR_TOKEN_SIZE. >> > Okay, I see it. > But this is a problem that we may need longer string than STR_TOKEN_SIZE in multi token case. > So what you think about adding new typedef cmdline_multi_string_t for this case? > For example: > #define STR_MULTI_TOKEN_SIZE 1024 > typedef char cmdline_multi_string_t[STR_MULTI_TOKEN_SIZE]; It should do the job, indeed. By the way, it would be nice to have an example of use. Regards, Olivier