Date: Mon, 16 May 2016 23:47:08 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299991 - head/usr.sbin/ppp Message-ID: <201605162347.u4GNl857092250@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: truckman Date: Mon May 16 23:47:08 2016 New Revision: 299991 URL: https://svnweb.freebsd.org/changeset/base/299991 Log: 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 MFC after: 1 week Modified: head/usr.sbin/ppp/link.c Modified: head/usr.sbin/ppp/link.c ============================================================================== --- head/usr.sbin/ppp/link.c Mon May 16 23:40:32 2016 (r299990) +++ head/usr.sbin/ppp/link.c Mon May 16 23:47:08 2016 (r299991) @@ -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?201605162347.u4GNl857092250>