From 81274c6726a35c4bcb113e5c7c32a56cc66fd83b Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 9 May 2007 19:27:30 +0000 Subject: Allow zero size with non-null buf in *asnprintf. * libc/stdio/asnprintf.c (_asnprintf_r, asnprintf): Avoid free'ing user's buf. * libc/stdio/asniprintf.c (_asniprintf_r, asniprintf): Likewise. * libc/stdio/vasniprintf.c (_vasniprintf_r): Likewise. * libc/stdio/vasnprintf.c (_vasnprintf_r): Likewise. --- newlib/libc/stdio/asnprintf.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'newlib/libc/stdio/asnprintf.c') diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c index 78d10e803..ef9bd8900 100644 --- a/newlib/libc/stdio/asnprintf.c +++ b/newlib/libc/stdio/asnprintf.c @@ -34,6 +34,7 @@ _DEFUN(_asnprintf_r, (ptr, buf, lenp, fmt), /* mark a zero-length reallocatable buffer */ f._flags = __SWR | __SSTR | __SMBF; len = 0; + buf = NULL; } f._bf._base = f._p = (unsigned char *) buf; /* For now, inherit the 32-bit signed limit of FILE._bf._size. @@ -80,6 +81,7 @@ _DEFUN(asnprintf, (buf, lenp, fmt), /* mark a zero-length reallocatable buffer */ f._flags = __SWR | __SSTR | __SMBF; len = 0; + buf = NULL; } f._bf._base = f._p = (unsigned char *) buf; /* For now, inherit the 32-bit signed limit of FILE._bf._size. -- cgit v1.2.3