summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-16 23:47:08 +0000
committertruckman <truckman@FreeBSD.org>2016-05-16 23:47:08 +0000
commit21d390bffda90ecba2c4fc485c8cbc5bddcaf35f (patch)
tree16482dec4a494d983ab2d4952f91fadbd862fa24 /usr.sbin/ppp
parent8e80be76fe011e7ff1278fb6ec1a85f3fa3bff5c (diff)
downloadFreeBSD-src-21d390bffda90ecba2c4fc485c8cbc5bddcaf35f.zip
FreeBSD-src-21d390bffda90ecba2c4fc485c8cbc5bddcaf35f.tar.gz
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
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/link.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/ppp/link.c b/usr.sbin/ppp/link.c
index dc5507d..f802b95 100644
--- a/usr.sbin/ppp/link.c
+++ b/usr.sbin/ppp/link.c
@@ -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_short proto, int type)
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
OpenPOWER on IntegriCloud