Commit 3b108f18 authored by Ondřej Zajíček's avatar Ondřej Zajíček
Browse files

One null-pointer dereference bugfix hidden in whitespace changes

parent 0dd7ccc7
...@@ -126,7 +126,7 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_ ...@@ -126,7 +126,7 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_
break; break;
case OSPF_AUTH_SIMPLE: case OSPF_AUTH_SIMPLE:
pass = password_find(ifa->passwords, 1); pass = password_find(ifa->passwords, 1);
if(!pass) if (!pass)
{ {
OSPF_TRACE(D_PACKETS, "OSPF_auth: no password found"); OSPF_TRACE(D_PACKETS, "OSPF_auth: no password found");
return 0; return 0;
...@@ -149,6 +149,7 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_ ...@@ -149,6 +149,7 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_
OSPF_TRACE(D_PACKETS, "OSPF_auth: wrong size of md5 digest"); OSPF_TRACE(D_PACKETS, "OSPF_auth: wrong size of md5 digest");
return 0; return 0;
} }
if (ntohs(pkt->length) + OSPF_AUTH_CRYPT_SIZE != size) if (ntohs(pkt->length) + OSPF_AUTH_CRYPT_SIZE != size)
{ {
OSPF_TRACE(D_PACKETS, "OSPF_auth: size mismatch (%d vs %d)", OSPF_TRACE(D_PACKETS, "OSPF_auth: size mismatch (%d vs %d)",
...@@ -164,6 +165,8 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_ ...@@ -164,6 +165,8 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_
tail = ((void *)pkt) + ntohs(pkt->length); tail = ((void *)pkt) + ntohs(pkt->length);
if (ifa->passwords)
{
WALK_LIST(ptmp, *(ifa->passwords)) WALK_LIST(ptmp, *(ifa->passwords))
{ {
if (pkt->u.md5.keyid != ptmp->id) continue; if (pkt->u.md5.keyid != ptmp->id) continue;
...@@ -171,14 +174,15 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_ ...@@ -171,14 +174,15 @@ ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_
pass = ptmp; pass = ptmp;
break; break;
} }
}
if(!pass) if (!pass)
{ {
OSPF_TRACE(D_PACKETS, "OSPF_auth: no suitable md5 password found"); OSPF_TRACE(D_PACKETS, "OSPF_auth: no suitable md5 password found");
return 0; return 0;
} }
if(n) if (n)
{ {
if(ntohs(pkt->u.md5.csn) < n->csn) if(ntohs(pkt->u.md5.csn) < n->csn)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment