提交 ef550786 编写于 作者: R Rich Felker

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.
上级 c2080450
...@@ -265,8 +265,10 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap) ...@@ -265,8 +265,10 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
if (size == SIZE_l) *(wchar_t **)dest = wcs; if (size == SIZE_l) *(wchar_t **)dest = wcs;
else *(char **)dest = s; else *(char **)dest = s;
} }
if (t != 'c') {
if (wcs) wcs[i] = 0; if (wcs) wcs[i] = 0;
if (s) s[i] = 0; if (s) s[i] = 0;
}
break; break;
case 'p': case 'p':
case 'X': case 'X':
......
...@@ -281,8 +281,10 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap) ...@@ -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; if (size == SIZE_l) *(wchar_t **)dest = wcs;
else *(char **)dest = s; else *(char **)dest = s;
} }
if (t != 'c') {
if (wcs) wcs[i] = 0; if (wcs) wcs[i] = 0;
if (s) s[i] = 0; if (s) s[i] = 0;
}
break; break;
case 'd': case 'i': case 'o': case 'u': case 'x': case 'd': case 'i': case 'o': case 'u': case 'x':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册