bugAVR C Runtime Library - Bugs: bug #10420, sscanf(), If there is a decimal...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #10420: sscanf(), If there is a decimal number followed by the character '_' in the buffer, you can't get the the number.

Submitter:  None
Submitted:  Fri 17 Sep 2004 03:32:25 AM UTC
   
 
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  troth
Percent Complete:  0% Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  None
Fixed Release:  None

Sun 19 Sep 2004 09:10:08 PM UTC, comment #2: 

Fixed in both, HEAD and avr-libc-1_0-branch.

Tbanks to Ted for his good analysis of the problem!

Joerg Wunsch <joerg_wunsch>
Group administrator
Fri 17 Sep 2004 06:53:15 PM UTC, comment #1: 

I posted a potential fix to the dev mailing list. If the fix is acceptable, I'll commit it and close out this bug.

Thank you for supplying a concise example demostrating the problem. That made finding the problem trivial.

Theodore A. Roth <troth>
Fri 17 Sep 2004 03:32:25 AM UTC, original submission:  

I think there may be some troubles with the function sscanf(),

Lets have a look at the following example:

void mc(void)
{
    char buf[64] = "<1/dr_2_600";
    int addr,port,speed;

    sscanf(buf,"<%d/dr_%d_%d",&addr,&port,&speed);
    printf("addr=%d,port=%d,speed=%d\n",addr,port,speed);
    return;
}

The expecting results are: addr=1, port=2,speed=600.
However,the actual results are: addr=1,port=28600, and 'speed' gets a invalid value.






Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-09-19 joerg_wunsch StatusNone Fixed
    Open/ClosedOpen Closed
2004-09-17 troth CategoryNone Library
    Assigned toNone troth

Back to the top

Powered by Savane 3.13-caa5.
Corresponding source code