From owner-svn-src-all@freebsd.org Mon May 23 05:41:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BE40B4649D; Mon, 23 May 2016 05:41:24 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C29118BD; Mon, 23 May 2016 05:41:24 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4N5fNWQ091868; Mon, 23 May 2016 05:41:23 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N5fNZL091867; Mon, 23 May 2016 05:41:23 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201605230541.u4N5fNZL091867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 23 May 2016 05:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300470 - stable/10/usr.sbin/ppp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 05:41:24 -0000 Author: truckman Date: Mon May 23 05:41:23 2016 New Revision: 300470 URL: https://svnweb.freebsd.org/changeset/base/300470 Log: MFC r299991 Don't walk off the end of the array when proto isn't explicitly listed above. Instead update the catch-all "Others" bucket. Reported by: Coverity CID: 1007571, 1007572 Modified: stable/10/usr.sbin/ppp/link.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ppp/link.c ============================================================================== --- stable/10/usr.sbin/ppp/link.c Mon May 23 05:38:40 2016 (r300469) +++ stable/10/usr.sbin/ppp/link.c Mon May 23 05:41:23 2016 (r300470) @@ -209,7 +209,7 @@ static struct protostatheader { { PROTO_LQR, "LQR" }, { PROTO_CHAP, "CHAP" }, { PROTO_MP, "MULTILINK" }, - { 0, "Others" } + { 0, "Others" } /* must be last */ }; void @@ -218,13 +218,13 @@ link_ProtocolRecord(struct link *l, u_sh int i; for (i = 0; i < NPROTOSTAT; i++) - if (ProtocolStat[i].number == proto) + if (ProtocolStat[i].number == proto || ProtocolStat[i].number == 0) { + if (type == PROTO_IN) + l->proto_in[i]++; + else + l->proto_out[i]++; break; - - if (type == PROTO_IN) - l->proto_in[i]++; - else - l->proto_out[i]++; + } } void