diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-06-22 17:23:45 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-06-22 17:23:45 -0400 |
commit | ef5507867b59d19f21437970e87b5d0415c07b2e (patch) | |
tree | c08887f82e0896740a636af337242d0c3ba2f4d9 /src/stdio/vfwscanf.c | |
parent | c20804500deebaabc56f383d48dd1ac77dce8349 (diff) | |
download | musl-ef5507867b59d19f21437970e87b5d0415c07b2e.tar.gz musl-ef5507867b59d19f21437970e87b5d0415c07b2e.tar.bz2 musl-ef5507867b59d19f21437970e87b5d0415c07b2e.tar.xz musl-ef5507867b59d19f21437970e87b5d0415c07b2e.zip |
fix scanf %c conversion wrongly storing a terminating null byte
this seems to have been a regression from the refactoring which added
the 'm' modifier.
Diffstat (limited to 'src/stdio/vfwscanf.c')
-rw-r--r-- | src/stdio/vfwscanf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c index b1eb7939..760864ff 100644 --- a/src/stdio/vfwscanf.c +++ b/src/stdio/vfwscanf.c @@ -281,8 +281,10 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap) if (size == SIZE_l) *(wchar_t **)dest = wcs; else *(char **)dest = s; } - if (wcs) wcs[i] = 0; - if (s) s[i] = 0; + if (t != 'c') { + if (wcs) wcs[i] = 0; + if (s) s[i] = 0; + } break; case 'd': case 'i': case 'o': case 'u': case 'x': |