Bug 11569 - sscanf doesn't parse character sequence ranges properly
sscanf doesn't parse character sequence ranges properly
Status: CLOSED RAWHIDE
Product: Red Hat Raw Hide
Classification: Retired
Component: glibc (Show other bugs)
1.0
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-05-21 23:58 EDT by Jonathan Kamens
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 00:03:23 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)
scanf patch (483 bytes, patch)
2000-05-21 23:59 EDT, Jonathan Kamens
no flags Details | Diff

  None (edit)
Description Jonathan Kamens 2000-05-21 23:58:42 EDT
The output of this program:

#include <stdio.h>

main()
{
  char buf[10] = {};
  int num;

  num = sscanf("012345", "%9[0-9]", buf);
  printf("num=%d, buf=\"%s\"\n", num, buf);
}

Should be:

num=1, buf="012345"

and indeed it is with glibc-2.1.2-11.  Unfortunately, with glibc-2.1.90-11,
the output is:

num=1, buf="0"

The attached patch fixes this problem.
Comment 1 Jonathan Kamens 2000-05-21 23:59:59 EDT
Created attachment 261 [details]
scanf patch
Comment 2 Jonathan Kamens 2000-05-22 00:03:59 EDT
Lest you think this isn't a big deal, note that it prevents netstat from being
able to print information about tcp or udp connections.
Comment 3 Jakub Jelinek 2000-08-24 06:30:44 EDT
Again, bugzilla not updated, fixed on 05-22

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