public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Fix vfwscanf(3) assignment suppression flag handling bug
Date: Mon, 03 Jun 2019 08:40:00 -0000 [thread overview]
Message-ID: <20190603084037.106834.qmail@sourceware.org> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1440 bytes --]
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d5daede26c651f4e9d6c7abbd2dd2937a1e24e2d
commit d5daede26c651f4e9d6c7abbd2dd2937a1e24e2d
Author: Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
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] <http://pubs.opengroup.org/onlinepubs/009695399/functions/fwscanf.html>
--
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':
reply other threads:[~2019-06-03 8:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190603084037.106834.qmail@sourceware.org \
--to=corinna@sourceware.org \
--cc=newlib-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).