Date: Fri, 23 Dec 2011 02:00:29 GMT From: dfilter@FreeBSD.ORG (dfilter service) To: freebsd-bugs@FreeBSD.org Subject: Re: bin/83348: commit references a PR Message-ID: <201112230200.pBN20TRO054110@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/83348; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org 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'; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112230200.pBN20TRO054110>