public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] stdio: Parse 0x0p+00 correctly in scanf
@ 2021-06-18 21:15 Jeff Johnston
0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2021-06-18 21:15 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=92068f4cc5f2cb655b32a46fdba93a9e572c307b
commit 92068f4cc5f2cb655b32a46fdba93a9e572c307b
Author: Keith Packard <keithp@keithp.com>
Date: Fri Jun 18 11:09:48 2021 -0700
stdio: Parse 0x0p+00 correctly in scanf
The scanf code was skipping the '0' after the 'x' causing the
resulting buffer to contain an invalid number when passed to strtod.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diff:
---
newlib/libc/stdio/vfscanf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 1d5e6512a..037692531 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -1628,6 +1628,7 @@ __SVFSCANF_R (struct _reent *rptr,
&& zeroes == 1)
{
flags |= HEXFLT;
+ flags &= ~NDIGITS;
/* We skipped the first zero, so we have to add
it now to the buffer. */
*p++ = '0';
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-18 21:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 21:15 [newlib-cygwin] stdio: Parse 0x0p+00 correctly in scanf Jeff Johnston
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).