Module Name: src Committed By: kefren Date: Tue Jan 4 10:58:15 UTC 2011
Modified Files: src/usr.sbin/ldpd: mpls_routes.c Log Message: check from_cidr_to_union() result To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/ldpd/mpls_routes.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/ldpd/mpls_routes.c diff -u src/usr.sbin/ldpd/mpls_routes.c:1.2 src/usr.sbin/ldpd/mpls_routes.c:1.3 --- src/usr.sbin/ldpd/mpls_routes.c:1.2 Thu Dec 9 00:10:59 2010 +++ src/usr.sbin/ldpd/mpls_routes.c Tue Jan 4 10:58:15 2011 @@ -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);