From patchwork Wed Sep 17 00:39:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 37497 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B5342057E for ; Wed, 17 Sep 2014 00:40:05 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u57sf338680wes.11 for ; Tue, 16 Sep 2014 17:40:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=0TKNgGCVDnfMnd01vZwDSQ/Awu65OQX71MDKfwRsvlg=; b=LlKC6e18wWoB+L56Q8tcduAe5NcQcqsmq0l4j4NP31IvTsIpa9v/w1/+fJZOpRRKqL bc7qjIKcJoJKmxac+JHJuxf8yXaYSuujTl34VSpsGjl3q4t81VKDGLslq1z4iL4WTjTz 9OHszvysb6P1gmJCsBBrzB0UhgXaoa65hesKO65sCZtP6/By2nfrMddZvPXEiXi2DGvi EaWRXPhqKRAvpBGm5+QoB/rpCLoF3bS5qly65EF71F+wWQLbMG4zRhGwJaRK/xgtILn5 bTzwl5idTCNSELwYiDfvUaLklizacyaiZV2t06uNuV3AIsUsDoJDK0smZ9nb4iTbfMHs a6hg== X-Gm-Message-State: ALoCoQlMii/daxQGorgnS1W+REmWI9bPPjt53Rt100s8L1Db3P0mvtr7MJs2UM3c60OKW5Y2Hwos X-Received: by 10.180.24.225 with SMTP id x1mr284996wif.2.1410914404473; Tue, 16 Sep 2014 17:40:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.39 with SMTP id k7ls54284lae.109.gmail; Tue, 16 Sep 2014 17:40:04 -0700 (PDT) X-Received: by 10.152.42.173 with SMTP id p13mr15904711lal.23.1410914404188; Tue, 16 Sep 2014 17:40:04 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx.google.com with ESMTPS id r1si26360420laj.107.2014.09.16.17.40.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 17:40:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id b17so855499lan.32 for ; Tue, 16 Sep 2014 17:40:04 -0700 (PDT) X-Received: by 10.112.130.129 with SMTP id oe1mr37684903lbb.4.1410914404086; Tue, 16 Sep 2014 17:40:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp492860lbb; Tue, 16 Sep 2014 17:40:03 -0700 (PDT) X-Received: by 10.224.88.71 with SMTP id z7mr25754482qal.94.1410914403071; Tue, 16 Sep 2014 17:40:03 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id w38si2601011qgw.25.2014.09.16.17.40.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Sep 2014 17:40:03 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XU3Hs-0008AZ-Ni; Wed, 17 Sep 2014 00:40:00 +0000 Received: from mail-qc0-f173.google.com ([209.85.216.173]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XU3Hn-0008AU-EJ for lng-odp@lists.linaro.org; Wed, 17 Sep 2014 00:39:55 +0000 Received: by mail-qc0-f173.google.com with SMTP id i8so1017676qcq.18 for ; Tue, 16 Sep 2014 17:39:50 -0700 (PDT) X-Received: by 10.140.102.210 with SMTP id w76mr52027207qge.17.1410914390210; Tue, 16 Sep 2014 17:39:50 -0700 (PDT) Received: from fedora1.holmesfamily.ws (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by mx.google.com with ESMTPSA id 21sm151777qgh.42.2014.09.16.17.39.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Sep 2014 17:39:49 -0700 (PDT) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Tue, 16 Sep 2014 20:39:25 -0400 Message-Id: <1410914365-32781-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] odp_packet_socket.c: Fix buffer overrun X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Mike Holmes --- The for loop exitis with i=50 if raw_sockets[i].fd == 0 is not hit in the loop Guard against this correctly by replacing the spcific test for 49 with greater than 49 which is the real error case for over running the buffer raw_sockets[i].fd platform/linux-generic/odp_packet_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index d1ea087..279a0cb 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -141,7 +141,7 @@ static int add_raw_fd(const char *netdev, int fd) break; } - if (i == (MAX_RAW_SOCKETS_NETDEVS - 1)) { + if (i > (MAX_RAW_SOCKETS_NETDEVS - 1)) { ODP_ERR("too many sockets\n"); return -1; }