mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Properly initialize a temporary FILE that is allocated off the stack.
The change to reuse _up from FILE (to allow FILE to grow without changing size) overlooked FILE being allocated off the stack. Approved by: sobomax
This commit is contained in:
parent
aca66ea036
commit
fcd70a7565
2 changed files with 10 additions and 0 deletions
|
|
@ -103,3 +103,10 @@ struct __sFILEX {
|
|||
free((char *)(fp)->_lb._base); \
|
||||
(fp)->_lb._base = NULL; \
|
||||
}
|
||||
|
||||
#define INITEXTRA(fp) { \
|
||||
(fp)->_extra->_up = NULL; \
|
||||
(fp)->_extra->fl_mutex = PTHREAD_MUTEX_INITIALIZER; \
|
||||
(fp)->_extra->fl_owner = NULL; \
|
||||
(fp)->_extra->fl_count = 0; \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ sscanf(str, fmt, va_alist)
|
|||
{
|
||||
int ret;
|
||||
va_list ap;
|
||||
struct __sFILEX extra;
|
||||
FILE f;
|
||||
|
||||
f._file = -1;
|
||||
|
|
@ -86,6 +87,8 @@ sscanf(str, fmt, va_alist)
|
|||
f._read = eofread;
|
||||
f._ub._base = NULL;
|
||||
f._lb._base = NULL;
|
||||
f._extra = &extra;
|
||||
INITEXTRA(&f);
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
|
|
|
|||
Loading…
Reference in a new issue