diff options
author | Eric Blake <eblake@redhat.com> | 2007-05-09 19:27:30 +0000 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2007-05-09 19:27:30 +0000 |
commit | 81274c6726a35c4bcb113e5c7c32a56cc66fd83b (patch) | |
tree | ff31c05adc01f8b16e02d89545e3912bcdc4a491 /newlib/libc | |
parent | 38ed4e5111c37e87892efc3f5dcda88137ed519b (diff) | |
download | newlib-81274c6726a35c4bcb113e5c7c32a56cc66fd83b.zip newlib-81274c6726a35c4bcb113e5c7c32a56cc66fd83b.tar.gz newlib-81274c6726a35c4bcb113e5c7c32a56cc66fd83b.tar.bz2 |
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.
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/stdio/asniprintf.c | 2 | ||||
-rw-r--r-- | newlib/libc/stdio/asnprintf.c | 2 | ||||
-rw-r--r-- | newlib/libc/stdio/vasniprintf.c | 1 | ||||
-rw-r--r-- | newlib/libc/stdio/vasnprintf.c | 1 |
4 files changed, 6 insertions, 0 deletions
diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c index 202d8c1..dd74b7c 100644 --- a/newlib/libc/stdio/asniprintf.c +++ b/newlib/libc/stdio/asniprintf.c @@ -34,6 +34,7 @@ _DEFUN(_asniprintf_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(asniprintf, (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. diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c index 78d10e8..ef9bd89 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. diff --git a/newlib/libc/stdio/vasniprintf.c b/newlib/libc/stdio/vasniprintf.c index eff6dfd..1e5d600 100644 --- a/newlib/libc/stdio/vasniprintf.c +++ b/newlib/libc/stdio/vasniprintf.c @@ -34,6 +34,7 @@ _DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap), /* 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. diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c index 923ed83..740aa07 100644 --- a/newlib/libc/stdio/vasnprintf.c +++ b/newlib/libc/stdio/vasnprintf.c @@ -34,6 +34,7 @@ _DEFUN(_vasnprintf_r, (ptr, buf, lenp, fmt, ap), /* 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. |