mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
fix undefined behavior in wcsto[ld] family functions
analogous to commit b287cd745c
but for
the custom FILE stream type the wcstol and wcstod family use. __toread
could be used here as well, but there's a simple direct fix to make
the buffer pointers initially valid for subtraction, so just do that
to avoid pulling in stdio exit code in programs that don't use stdio.
This commit is contained in:
parent
043c6e31d9
commit
f3ecdc1043
2 changed files with 2 additions and 4 deletions
|
@ -33,8 +33,7 @@ static long double wcstox(const wchar_t *s, wchar_t **p, int prec)
|
|||
unsigned char buf[64];
|
||||
FILE f = {0};
|
||||
f.flags = 0;
|
||||
f.rpos = f.rend = 0;
|
||||
f.buf = buf + 4;
|
||||
f.rpos = f.rend = f.buf = buf + 4;
|
||||
f.buf_size = sizeof buf - 4;
|
||||
f.lock = -1;
|
||||
f.read = do_read;
|
||||
|
|
|
@ -35,8 +35,7 @@ static unsigned long long wcstox(const wchar_t *s, wchar_t **p, int base, unsign
|
|||
unsigned char buf[64];
|
||||
FILE f = {0};
|
||||
f.flags = 0;
|
||||
f.rpos = f.rend = 0;
|
||||
f.buf = buf + 4;
|
||||
f.rpos = f.rend = f.buf = buf + 4;
|
||||
f.buf_size = sizeof buf - 4;
|
||||
f.lock = -1;
|
||||
f.read = do_read;
|
||||
|
|
Loading…
Add table
Reference in a new issue