Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 May 2016 05:41:23 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
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
Message-ID:  <201605230541.u4N5fNZL091867@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605230541.u4N5fNZL091867>