Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ldpd check from_cidr_to_union() result



details:   https://anonhg.NetBSD.org/src/rev/4f707744fa42
branches:  trunk
changeset: 760413:4f707744fa42
user:      kefren <kefren%NetBSD.org@localhost>
date:      Tue Jan 04 10:58:15 2011 +0000

description:
check from_cidr_to_union() result

diffstat:

 usr.sbin/ldpd/mpls_routes.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r d069a3f130ad -r 4f707744fa42 usr.sbin/ldpd/mpls_routes.c
--- a/usr.sbin/ldpd/mpls_routes.c       Tue Jan 04 10:42:33 2011 +0000
+++ b/usr.sbin/ldpd/mpls_routes.c       Tue Jan 04 10:58:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpls_routes.c,v 1.2 2010/12/09 00:10:59 christos Exp $ */
+/* $NetBSD: mpls_routes.c,v 1.3 2011/01/04 10:58:15 kefren Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -617,7 +617,8 @@
                prefixlen = from_mask_to_cidr(inet_ntoa(so_pref->sin.sin_addr));
        else {
                prefixlen = 32;
-               so_pref = from_cidr_to_union(32);
+               if ((so_pref = from_cidr_to_union(32)) == NULL)
+                       return LDP_E_MEMORY;
                so_pref_allocated = 1;
        }
 
@@ -791,9 +792,10 @@
                        so_gate = GETNEXT(so_dst);
 
                /* Get prefix */
-               if (rtmes->rtm_flags & RTF_HOST)
-                       so_pref = from_cidr_to_union(32);
-               else if (rtmes->rtm_addrs & RTA_GATEWAY)
+               if (rtmes->rtm_flags & RTF_HOST) {
+                       if ((so_pref = from_cidr_to_union(32)) == NULL)
+                               return LDP_E_MEMORY;
+               } else if (rtmes->rtm_addrs & RTA_GATEWAY)
                        so_pref = GETNEXT(so_gate);
                else
                        so_pref = GETNEXT(so_dst);



Home | Main Index | Thread Index | Old Index