From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2134) id 03A3E383303A; Fri, 18 Jun 2021 21:15:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03A3E383303A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jeff Johnston To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] stdio: Parse 0x0p+00 correctly in scanf X-Act-Checkin: newlib-cygwin X-Git-Author: Keith Packard X-Git-Refname: refs/heads/master X-Git-Oldrev: 90a72f27d5f724b496525b54a5d9f99cdcecbb9c X-Git-Newrev: 92068f4cc5f2cb655b32a46fdba93a9e572c307b Message-Id: <20210618211548.03A3E383303A@sourceware.org> Date: Fri, 18 Jun 2021 21:15:48 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 21:15:48 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=92068f4cc5f2cb655b32a46fdba93a9e572c307b commit 92068f4cc5f2cb655b32a46fdba93a9e572c307b Author: Keith Packard 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 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';