From patchwork Mon Mar 7 23:36:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 593746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 4B6581402A8 for ; Tue, 8 Mar 2016 10:37:54 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1AB751059E; Mon, 7 Mar 2016 15:37:53 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 6B9C510535 for ; Mon, 7 Mar 2016 15:37:52 -0800 (PST) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 036D2161C6A for ; Mon, 7 Mar 2016 16:37:52 -0700 (MST) X-ASG-Debug-ID: 1457393871-0b32374ff205b00001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar6.cudamail.com with ESMTP id yfU1d45qGpqGE5uG (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 07 Mar 2016 16:37:51 -0700 (MST) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO relay2-d.mail.gandi.net) (217.70.183.194) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 7 Mar 2016 23:37:51 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at ovn.org designates 217.70.183.194 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.194 X-Barracuda-RBL-IP: 217.70.183.194 Received: from mfilter10-d.gandi.net (mfilter10-d.gandi.net [217.70.178.139]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id DB4FAC5A61; Tue, 8 Mar 2016 00:37:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter10-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter10-d.gandi.net (mfilter10-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id rtzc_GeF7Znp; Tue, 8 Mar 2016 00:37:47 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from localhost.localdomain (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 964E2C5A60; Tue, 8 Mar 2016 00:37:46 +0100 (CET) X-CudaMail-Envelope-Sender: joe@ovn.org From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-306091297 X-CudaMail-DTE: 030716 X-CudaMail-Originating-IP: 217.70.183.194 Date: Mon, 7 Mar 2016 15:36:36 -0800 X-ASG-Orig-Subj: [##CM-E2-306091297##][PATCH] ofp-actions: Assert variable actions have len>0. Message-Id: <1457393798-24932-1-git-send-email-joe@ovn.org> X-Mailer: git-send-email 2.1.4 X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1457393871 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH] ofp-actions: Assert variable actions have len>0. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Variable-length actions must have a nonzero length; if they don't, something went wrong and we should bail out. Suggested-by: Ben Pfaff Signed-off-by: Joe Stringer Acked-by: Ben Pfaff --- lib/ofp-actions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index a7c0388adeaa..e5fe8e608986 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -7407,7 +7407,7 @@ ofpact_finish(struct ofpbuf *ofpacts, struct ofpact *ofpact) ovs_assert(ofpact == ofpacts->header); len = (char *) ofpbuf_tail(ofpacts) - (char *) ofpact; - ovs_assert(len <= UINT16_MAX); + ovs_assert(len && len <= UINT16_MAX); ofpact->len = len; ofpbuf_padto(ofpacts, OFPACT_ALIGN(ofpacts->size));