The following reply was made to PR bin/83348; it has been noted by GNATS.

From: [email protected] (dfilter service)
To: [email protected]
Cc:  
Subject: Re: bin/83348: commit references a PR
Date: Fri, 23 Dec 2011 01:56:39 +0000 (UTC)

 Author: ghelmer
 Date: Fri Dec 23 01:56:25 2011
 New Revision: 228826
 URL: http://svn.freebsd.org/changeset/base/228826
 
 Log:
   Handle failures to malloc memory to hold key or val copies.
   
   PR:          bin/83348
 
 Modified:
   head/lib/libc/yp/xdryp.c
 
 Modified: head/lib/libc/yp/xdryp.c
 ==============================================================================
 --- head/lib/libc/yp/xdryp.c   Fri Dec 23 01:39:10 2011        (r228825)
 +++ head/lib/libc/yp/xdryp.c   Fri Dec 23 01:56:25 2011        (r228826)
 @@ -82,10 +82,21 @@ xdr_ypresp_all_seq(XDR *xdrs, u_long *ob
                switch (status) {
                case YP_TRUE:
                        key = (char 
*)malloc(out.ypresp_all_u.val.key.keydat_len + 1);
 +                      if (key == NULL) {
 +                              xdr_free((xdrproc_t)xdr_ypresp_all, &out);
 +                              *objp = YP_YPERR;
 +                              return (FALSE);
 +                      }
                        bcopy(out.ypresp_all_u.val.key.keydat_val, key,
                                out.ypresp_all_u.val.key.keydat_len);
                        key[out.ypresp_all_u.val.key.keydat_len] = '\0';
                        val = (char 
*)malloc(out.ypresp_all_u.val.val.valdat_len + 1);
 +                      if (val == NULL) {
 +                              free(key);
 +                              xdr_free((xdrproc_t)xdr_ypresp_all, &out);
 +                              *objp = YP_YPERR;
 +                              return (FALSE);
 +                      }
                        bcopy(out.ypresp_all_u.val.val.valdat_val, val,
                                out.ypresp_all_u.val.val.valdat_len);
                        val[out.ypresp_all_u.val.val.valdat_len] = '\0';
 _______________________________________________
 [email protected] mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "[email protected]"
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to