Bug 9886 - Bug in scanf in glibc 2.1
Bug in scanf in glibc 2.1
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.1
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-03-01 07:15 EST by rk
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-05-22 10:53:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description rk 2000-03-01 07:15:01 EST
Bug in scanf in glibc 2.1

The following short program (see below) describes it:

Compiled on a Redhat 6.1 machine the results of the program are:

	sscanf("01234567", "%4lf%4d", &x, &y)
	x=1234.000000
	y=567

But it shoud be (compiled on all other machines in our company
the results are):

	sscanf("01234567", "%4lf%4d", &x, &y)
	x=123.000000
	y=4567


#include <stdio.h>
#include <math.h>

int main(int argc, const char **argv)
{
   double x = 0.0;
   int    y = 0;
   char a[] = "01234567";
   char b[] = "%4lf%4d";

   sscanf(a, b, &x, &y);
   printf("sscanf(\"%s\", \"%s\", &x, &y)\n", a, b);
   printf("x=%lf\n", x);
   printf("y=%d\n", y);
}
Comment 1 rk 2000-03-02 11:33:59 EST
The bug ist already fixed in the gnu-package:

http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl/full/1314
Comment 2 Cristian Gafton 2000-05-22 10:53:59 EDT
assign to jakub
Comment 3 Jakub Jelinek 2000-08-25 04:18:18 EDT
Fixed in glibc 2.1.92

Note You need to log in before you can comment on or make changes to this bug.