summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Gacogne <rgacogne-github@coredump.fr>2013-09-08 13:48:34 +0000
committerVincent JARDIN <vincent.jardin@6wind.com>2014-02-11 10:28:03 +0100
commita11e012e8661629d665e992e765741a5eaa7d017 (patch)
treed6967d9c5044f8c924aa2f4b62bac8e3bda358e2
parentb52aef18a9f3acc8b24ab5c2631dc574b8e2ec70 (diff)
downloadquagga-a11e012e8661629d665e992e765741a5eaa7d017.tar.bz2
quagga-a11e012e8661629d665e992e765741a5eaa7d017.tar.xz
security: Fix some typos and potential NULL-deref
This patch against the git tree fixes minor typos, some of them possibily leading to NULL-pointer dereference in rare conditions. Signed-off-by: Remi Gacogne <rgacogne-github@coredump.fr> Signed-off-by: Joachim Nilsson <troglobit@gmail.com> Acked-by: Feng Lu <lu.feng@6wind.com>
-rw-r--r--lib/vty.c2
-rw-r--r--ospf6d/ospf6_snmp.c2
-rw-r--r--ospfd/ospf_asbr.c3
-rw-r--r--ospfd/ospf_te.c3
-rw-r--r--zebra/irdp_packet.c2
5 files changed, 8 insertions, 4 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 0d6345c8..96cb1e4b 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1856,9 +1856,11 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family)
{
case AF_INET:
naddr=&su.sin.sin_addr;
+ break;
#ifdef HAVE_IPV6
case AF_INET6:
naddr=&su.sin6.sin6_addr;
+ break;
#endif
}
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index f8a3b920..46603927 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -528,7 +528,7 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
return NULL;
len = *length - v->namelen;
- len = (len >= 1 ? sizeof 1 : 0);
+ len = (len >= 1 ? 1 : 0);
if (exact && len != 1)
return NULL;
if (len)
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index a23b4f2b..7e7c84fd 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -164,7 +164,8 @@ ospf_external_info_add (u_char type, struct prefix_ipv4 p,
new->nexthop = nexthop;
new->tag = 0;
- rn->info = new;
+ if (rn)
+ rn->info = new;
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("Redistribute[%s]: %s/%d external info created.",
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 587564a1..c605ce68 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -1036,7 +1036,8 @@ ospf_mpls_te_lsa_refresh (struct ospf_lsa *lsa)
/* If the lsa's age reached to MaxAge, start flushing procedure. */
if (IS_LSA_MAXAGE (lsa))
{
- lp->flags &= ~LPFLG_LSA_ENGAGED;
+ if (lp)
+ lp->flags &= ~LPFLG_LSA_ENGAGED;
ospf_opaque_lsa_flush_schedule (lsa);
goto out;
}
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 28dc171e..50525043 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -287,7 +287,7 @@ send_packet(struct interface *ifp,
if (!(ifp->flags & IFF_UP))
return;
- if (!p)
+ if (p)
src = ntohl(p->u.prefix4.s_addr);
else
src = 0; /* Is filled in */