mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
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
This commit is contained in:
parent
fb403678c2
commit
647bedd5da
1 changed files with 7 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue