Bug 11569 - sscanf doesn't parse character sequence ranges properly
Summary: sscanf doesn't parse character sequence ranges properly
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 1.0
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-05-22 03:58 UTC by Jonathan Kamens
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-05-22 04:03:23 UTC
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-22 03:59 UTC, Jonathan Kamens
no flags Details | Diff

Description Jonathan Kamens 2000-05-22 03:58:42 UTC
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-22 03:59:59 UTC
Created attachment 261 [details]
scanf patch

Comment 2 Jonathan Kamens 2000-05-22 04:03:59 UTC
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 10:30:44 UTC
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.