Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 11569 - sscanf doesn't parse character sequence ranges properly
sscanf doesn't parse character sequence ranges properly
Product: Red Hat Raw Hide
Classification: Retired
Component: glibc (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  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:
Last Closed: 2000-05-22 00:03:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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>

  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.