https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d5daede26c651f4e9d6c7abbd2dd2937a1e24e2d commit d5daede26c651f4e9d6c7abbd2dd2937a1e24e2d Author: Lucio Andrés Illanes Albornoz Date: Sat Jun 1 10:33:19 2019 +0200 Fix vfwscanf(3) assignment suppression flag handling bug newlib's vfwscanf(3) (or specifically, __SVFWSCANF_R()) fails to correctly set the assignment-suppressing character (`*') flag[1] which, when present in the formatting string, results in undefined behaviour comprising retrieving and dereferencing a pointer that was not supplied by the caller as such or at all. When compared to the vfscanf(3) implementation, this would appear to be over the missing goto match_failure statement preceded by the flags test seen below. Hence, this patch (re)introduces it. [1] -- Diff: --- newlib/libc/stdio/vfwscanf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 0464b08..ffb6cc8 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -602,6 +602,7 @@ __SVFWSCANF_R (struct _reent *rptr, case L'*': if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS | MALLOC)) || width) + goto match_failure; flags |= SUPPRESS; goto again; case L'l':