From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by sourceware.org (Postfix) with ESMTPS id 247A8383582B for ; Fri, 18 Jun 2021 18:11:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 247A8383582B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=keithp.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=keithp.com Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 9C2993F28C2E for ; Fri, 18 Jun 2021 11:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1624039884; bh=xR5BVLy0oyiFOtrQiupcCw06BUO/jo8f1fubKcBm8PA=; h=From:To:Cc:Subject:Date:From; b=JtSZ/gRKOIH2NFlLvPF7MhXe5VUQqnqXS2XiryOPjcLxJFhHWI06YzTHZ/lFxwBCV 6BTrf7HqZrwVRrjOCw7Zw4Cz4U7w8HsfrUwLrBV074RF7hzZtpcLcky+AQ/CGPqlVX JG/WA73iAasN4H6aNhozbUioqenyL+NswNU6RP+HUVwpCySKt8Fiq/LHqM813cvL4W otTnvpaVgE7+eXku/8MvIlREgJxjej8hkGsy1WUV8SPNfmG6WbMJD4ItALH/BJ/NA/ Wi5uZpXAclnhwwgOwjV06lQth7NmuzoYJLHJqm0GG9+i8Jouu2jaL+k8Xql6vR5UGM WzLWgrCgPl3pg== X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NyKif62RpVHA; Fri, 18 Jun 2021 11:11:24 -0700 (PDT) Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 3731C3F28BD5; Fri, 18 Jun 2021 11:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1624039884; bh=xR5BVLy0oyiFOtrQiupcCw06BUO/jo8f1fubKcBm8PA=; h=From:To:Cc:Subject:Date:From; b=JtSZ/gRKOIH2NFlLvPF7MhXe5VUQqnqXS2XiryOPjcLxJFhHWI06YzTHZ/lFxwBCV 6BTrf7HqZrwVRrjOCw7Zw4Cz4U7w8HsfrUwLrBV074RF7hzZtpcLcky+AQ/CGPqlVX JG/WA73iAasN4H6aNhozbUioqenyL+NswNU6RP+HUVwpCySKt8Fiq/LHqM813cvL4W otTnvpaVgE7+eXku/8MvIlREgJxjej8hkGsy1WUV8SPNfmG6WbMJD4ItALH/BJ/NA/ Wi5uZpXAclnhwwgOwjV06lQth7NmuzoYJLHJqm0GG9+i8Jouu2jaL+k8Xql6vR5UGM WzLWgrCgPl3pg== Received: by keithp.com (Postfix, from userid 1000) id D52BA1E600C7; Fri, 18 Jun 2021 11:11:23 -0700 (PDT) From: Keith Packard To: newlib@sourceware.org Subject: [PATCH] stdio: Parse 0x0p+00 correctly in scanf Date: Fri, 18 Jun 2021 11:11:19 -0700 Message-Id: <20210618181119.1609818-1-keithp@keithp.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 18:11:35 -0000 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 --- 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'; -- 2.32.0