summaryrefslogtreecommitdiffstats
path: root/proto/ospf
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-01-11 10:51:54 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-01-11 10:51:54 +0100
commit0e9617e400d54f6f5119a24e7380b7719c2fc3dd (patch)
tree25ea0bb73e1a9412de4a4d4e522448c1bf4a62f6 /proto/ospf
parentf20907adf60960f63b797f4423b4790e8591e99c (diff)
downloadbird-0e9617e400d54f6f5119a24e7380b7719c2fc3dd.tar
bird-0e9617e400d54f6f5119a24e7380b7719c2fc3dd.zip
Move check for NULL before usage of variable.
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/packet.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index ee35282..5d47c48 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -232,6 +232,12 @@ ospf_rx_hook(sock * sk, int size)
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
+ if (ps == NULL)
+ {
+ log(L_ERR "%s%I - bad IP header", mesg, sk->faddr);
+ return 1;
+ }
+
if ((ifa->oa->areaid != 0) && (ntohl(ps->areaid) == 0))
{
WALK_LIST(iff, po->iface_list)
@@ -247,11 +253,6 @@ ospf_rx_hook(sock * sk, int size)
DBG("%s: RX_Hook called on interface %s.\n", p->name, sk->iface->name);
osize = ntohs(ps->length);
- if (ps == NULL)
- {
- log(L_ERR "%s%I - bad IP header", mesg, sk->faddr);
- return 1;
- }
if ((unsigned) size < sizeof(struct ospf_packet))
{