Fix wscanf family positional parameter handling in %lc, %ls, %l[]
* libc/stdio/vfwscanf.c (__SVFWSCANF_R): Convert wrong usage of va_arg to GET_ARG in %lc, %ls nad %l[] cases. Fix unterminated string in %l[] case. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
09d458b5c7
commit
001ef5af39
|
@ -1,3 +1,9 @@
|
|||
2015-08-03 Shoichi Sakon <s-sakon@ap.jp.nec.com>
|
||||
|
||||
* libc/stdio/vfwscanf.c (__SVFWSCANF_R): Convert wrong usage of va_arg
|
||||
to GET_ARG in %lc, %ls nad %l[] cases. Fix unterminated string in %l[]
|
||||
case.
|
||||
|
||||
2015-07-30 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libc/sys/rtems/include/sys/lock.h (__LOCK_INIT_RECURSIVE): Use
|
||||
|
|
|
@ -777,7 +777,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
|
|||
if (flags & LONG)
|
||||
{
|
||||
if (!(flags & SUPPRESS))
|
||||
p = va_arg(ap, wchar_t *);
|
||||
p = GET_ARG(N, ap, wchar_t *);
|
||||
n = 0;
|
||||
while (width-- != 0 && (wi = _fgetwc_r (rptr, fp)) != WEOF)
|
||||
{
|
||||
|
@ -794,7 +794,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
|
|||
else
|
||||
{
|
||||
if (!(flags & SUPPRESS))
|
||||
mbp = va_arg(ap, char *);
|
||||
mbp = GET_ARG(N, ap, char *);
|
||||
n = 0;
|
||||
memset ((_PTR)&mbs, '\0', sizeof (mbstate_t));
|
||||
while (width != 0 && (wi = _fgetwc_r (rptr, fp)) != WEOF)
|
||||
|
@ -849,7 +849,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
|
|||
}
|
||||
else if (flags & LONG)
|
||||
{
|
||||
p0 = p = va_arg(ap, wchar_t *);
|
||||
p0 = p = GET_ARG(N, ap, wchar_t *);
|
||||
while ((wi = _fgetwc_r (rptr, fp)) != WEOF
|
||||
&& width-- != 0 && INCCL (wi))
|
||||
*p++ = (wchar_t) wi;
|
||||
|
@ -858,11 +858,13 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
|
|||
n = p - p0;
|
||||
if (n == 0)
|
||||
goto match_failure;
|
||||
*p = L'\0';
|
||||
nassigned++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(flags & SUPPRESS))
|
||||
mbp = va_arg(ap, char *);
|
||||
mbp = GET_ARG(N, ap, char *);
|
||||
n = 0;
|
||||
memset ((_PTR) &mbs, '\0', sizeof (mbstate_t));
|
||||
while ((wi = _fgetwc_r (rptr, fp)) != WEOF
|
||||
|
@ -914,7 +916,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
|
|||
}
|
||||
else if (flags & LONG)
|
||||
{
|
||||
p0 = p = va_arg(ap, wchar_t *);
|
||||
p0 = p = GET_ARG(N, ap, wchar_t *);
|
||||
while ((wi = _fgetwc_r (rptr, fp)) != WEOF
|
||||
&& width-- != 0 && !iswspace (wi))
|
||||
{
|
||||
|
@ -923,13 +925,13 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap),
|
|||
}
|
||||
if (wi != WEOF)
|
||||
_ungetwc_r (rptr, wi, fp);
|
||||
*p = '\0';
|
||||
*p = L'\0';
|
||||
nassigned++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(flags & SUPPRESS))
|
||||
mbp = va_arg(ap, char *);
|
||||
mbp = GET_ARG(N, ap, char *);
|
||||
memset ((_PTR) &mbs, '\0', sizeof (mbstate_t));
|
||||
while ((wi = _fgetwc_r (rptr, fp)) != WEOF
|
||||
&& width != 0 && !iswspace (wi))
|
||||
|
|
Loading…
Reference in New Issue