mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 16:26:12 +08:00
* libc/stdio/fmemopen.c (fmemopen): Fix EINVAL condition. Avoid SEGV
if incoming buffer is NULL.
This commit is contained in:
parent
12374d7d2f
commit
d9db1bc555
@ -1,3 +1,8 @@
|
|||||||
|
2011-02-22 Corinna Vinschen <vinschen@redhat.com>
|
||||||
|
|
||||||
|
* libc/stdio/fmemopen.c (fmemopen): Fix EINVAL condition. Avoid SEGV
|
||||||
|
if incoming buffer is NULL.
|
||||||
|
|
||||||
2011-02-09 Eric Blake <eblake@redhat.com>
|
2011-02-09 Eric Blake <eblake@redhat.com>
|
||||||
|
|
||||||
* libc/include/string.h (strerror_r): Update declaration.
|
* libc/include/string.h (strerror_r): Update declaration.
|
||||||
|
@ -281,7 +281,7 @@ _DEFUN(_fmemopen_r, (ptr, buf, size, mode),
|
|||||||
|
|
||||||
if ((flags = __sflags (ptr, mode, &dummy)) == 0)
|
if ((flags = __sflags (ptr, mode, &dummy)) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!size || !(buf || flags & __SAPP))
|
if (!size || !(buf || flags & __SRW))
|
||||||
{
|
{
|
||||||
ptr->_errno = EINVAL;
|
ptr->_errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -310,7 +310,7 @@ _DEFUN(_fmemopen_r, (ptr, buf, size, mode),
|
|||||||
{
|
{
|
||||||
/* r+/w+/a+, and no buf: file starts empty. */
|
/* r+/w+/a+, and no buf: file starts empty. */
|
||||||
c->buf = (char *) (c + 1);
|
c->buf = (char *) (c + 1);
|
||||||
*(char *) buf = '\0';
|
c->buf[0] = '\0';
|
||||||
c->pos = c->eof = 0;
|
c->pos = c->eof = 0;
|
||||||
c->append = (flags & __SAPP) != 0;
|
c->append = (flags & __SAPP) != 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user