mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
Don't read past end of buffer in fmemopen
This commit is contained in:
committed by
Ulrich Drepper
parent
a5543c6ad8
commit
9d25c392ba
@@ -1,3 +1,7 @@
|
|||||||
|
2011-03-03 Andreas Schwab <schwab@redhat.com>
|
||||||
|
|
||||||
|
* libio/fmemopen.c (fmemopen): Don't read past end of buffer.
|
||||||
|
|
||||||
2011-03-03 Roland McGrath <roland@redhat.com>
|
2011-03-03 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
* setjmp/bits/setjmp2.h: Canonicalize comment formatting.
|
* setjmp/bits/setjmp2.h: Canonicalize comment formatting.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Fmemopen implementation.
|
/* Fmemopen implementation.
|
||||||
Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009
|
Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009, 2011
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Hanno Mueller, kontakt@hanno.de, 2000.
|
Contributed by Hanno Mueller, kontakt@hanno.de, 2000.
|
||||||
@@ -243,7 +243,7 @@ fmemopen (void *buf, size_t len, const char *mode)
|
|||||||
if (mode[0] == 'w')
|
if (mode[0] == 'w')
|
||||||
c->buffer[0] = '\0';
|
c->buffer[0] = '\0';
|
||||||
|
|
||||||
c->maxpos = strlen (c->buffer);
|
c->maxpos = strnlen (c->buffer, len);
|
||||||
|
|
||||||
if (mode[0] == 'a')
|
if (mode[0] == 'a')
|
||||||
c->pos = c->maxpos;
|
c->pos = c->maxpos;
|
||||||
|
Reference in New Issue
Block a user