diff options
author | Vincent Bernat <bernat@luffy.cx> | 2012-07-10 09:27:57 +0200 |
---|---|---|
committer | Vincent Bernat <bernat@luffy.cx> | 2012-07-10 09:27:57 +0200 |
commit | 0402ca4e92fa0904d5ee0926482ebca08ffd5c81 (patch) | |
tree | be0dd0aaec834c52372b6914f4f87260acb2b219 /ospf6d/ospf6_snmp.c | |
parent | ospf6d: add SNMP notifications/traps support (diff) | |
download | frr-0402ca4e92fa0904d5ee0926482ebca08ffd5c81.tar.xz frr-0402ca4e92fa0904d5ee0926482ebca08ffd5c81.zip |
ospf6d: fix segfault when requesting inexistant interfaces or areas
Diffstat (limited to 'ospf6d/ospf6_snmp.c')
-rw-r--r-- | ospf6d/ospf6_snmp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index a42e57acf..f8a3b9204 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -708,12 +708,13 @@ ospfv3WwLsdbEntry (struct variable *v, oid *name, size_t *length, else if (v->magic & OSPFv3WWAREATABLE) { oa = ospf6_area_lookup (area_id, ospf6); + if (!oa) return NULL; lsa = ospf6_lsdb_lookup (type, id, adv_router, oa->lsdb); } else if (v->magic & OSPFv3WWLINKTABLE) { oi = ospf6_interface_lookup_by_ifindex (ifindex); - if (oi->instance_id != instid) return NULL; + if (!oi || oi->instance_id != instid) return NULL; lsa = ospf6_lsdb_lookup (type, id, adv_router, oi->lsdb); } } @@ -875,7 +876,7 @@ ospfv3IfEntry (struct variable *v, oid *name, size_t *length, if (exact) { oi = ospf6_interface_lookup_by_ifindex (ifindex); - if (oi->instance_id != instid) return NULL; + if (!oi || oi->instance_id != instid) return NULL; } else { @@ -1034,8 +1035,8 @@ ospfv3NbrEntry (struct variable *v, oid *name, size_t *length, if (exact) { oi = ospf6_interface_lookup_by_ifindex (ifindex); + if (!oi || oi->instance_id != instid) return NULL; on = ospf6_neighbor_lookup (rtrid, oi); - if (oi->instance_id != instid) return NULL; } else { @@ -1060,7 +1061,8 @@ ospfv3NbrEntry (struct variable *v, oid *name, size_t *length, break; } if (on) break; - oi = on = NULL; + oi = NULL; + on = NULL; } list_delete_all_node (ifslist); |