From patchwork Wed Feb 4 09:49:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 2965 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 711ADADFC; Wed, 4 Feb 2015 10:49:45 +0100 (CET) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 45CD3ADFB for ; Wed, 4 Feb 2015 10:49:44 +0100 (CET) Received: by mail-wg0-f46.google.com with SMTP id l2so667210wgh.5 for ; Wed, 04 Feb 2015 01:49:44 -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:subject:date:message-id; bh=W1KSMWUpEguDPvFFR3wTc+hI9L3WJ80E5HaqKRo3laM=; b=JpXGYxer0RkMWYFe7Ci97x3DT/ACLwWkYnnz81uBp7B26X/7zxtosR5MK0W5ugVSIL +CFBMMmsTnjRIKWJQ5XkHKcc86CY70l4eAmvjvrdNnAvtVhNNJVQXP/H62LsaNnhri8g ecUyC06FHuAbnX/P279CLnfJUQCeoVJA78a18gsujTHSkm3wEPk6qMqY0C3uqgywPWv8 MfQTmys9AMb+zgBN7v5LPeVFFApzk/Ilc3PZ6CmImXmwk/yBlTnavW4Vlca95i+bmMdb kbkm9O+YhsYKQlcIlNyL26nWNtbC7m+oAmObTKU6bPYdXkl/HNSaLwhGdFIWlLX/mBLw X8Qg== X-Gm-Message-State: ALoCoQkeqt1cIuXmmC+RzESx2+OAEwDBq539e8oPM64Rporox1CigkIZ0fHLGz/V7HAtelCbsHHy X-Received: by 10.194.61.100 with SMTP id o4mr15367532wjr.28.1423043383990; Wed, 04 Feb 2015 01:49:43 -0800 (PST) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id tc2sm28409462wic.21.2015.02.04.01.49.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 01:49:43 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Wed, 4 Feb 2015 10:49:25 +0100 Message-Id: <1423043365-28462-1-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] cmdline: fix ressize in parse_portlist 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The argument ressize contains the size of the result buffer which should be large enough to store the parsed result of a token. In this case, it should be larger or equal to sizeof(cmdline_portlist_t) (4 bytes), not PORTLIST_TOKEN_SIZE which is the max size of the token string. This is not a critical, it fixes cases where the total length of the parsed instruction is greater than the maximum. Signed-off-by: Olivier Matz --- lib/librte_cmdline/cmdline_parse_portlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_cmdline/cmdline_parse_portlist.c b/lib/librte_cmdline/cmdline_parse_portlist.c index 834f2e6..fc6c14e 100644 --- a/lib/librte_cmdline/cmdline_parse_portlist.c +++ b/lib/librte_cmdline/cmdline_parse_portlist.c @@ -136,7 +136,7 @@ cmdline_parse_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, if (!buf || ! *buf) return (-1); - if (res && ressize < PORTLIST_TOKEN_SIZE) + if (res && ressize < sizeof(cmdline_portlist_t)) return -1; pl = res;