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 _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"