bugAVR C Runtime Library - Bugs: bug #22593, vfscanf improperly scans string...

 
 

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

bug #22593: vfscanf improperly scans string parameters with a width option by 1 character

Submitter:  brent sirna <bsirna>
Submitted:  Fri 14 Mar 2008 05:58:00 PM UTC
   
 
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Duplicate Assigned to:  dmix
Percent Complete:  100% Open/Closed:  Closed
Release:  None Fixed Release:  None

Tue 18 Mar 2008 01:37:03 PM UTC, comment #5: 

This is duplicate of bug #19079: was fixed.

Dmitry Xmelkov <dmix>
Group administrator
Fri 14 Mar 2008 07:30:26 PM UTC, comment #4: 


> Will this patch be applied to the 1.4 branch ?


Nope, the 1.4 branch is now officially closed -- well, as
officially as possible.  If there were a real "killer"
bug, we might consider another release, but otherwise no
CVS commits happen to that branch.

The scanf() fix is actually not even really a patch but
rather a complete rewrite, so that's for sure no material
for the 1.4 branch anyway even though it also fixes bugs.

Joerg Wunsch <joerg_wunsch>
Group administrator
Fri 14 Mar 2008 07:25:27 PM UTC, comment #3: 

Will this patch be applied to the 1.4 branch ?

thanks




brent sirna <bsirna>
Fri 14 Mar 2008 06:07:22 PM UTC, comment #2: 

This sounds a lot like bug #19079, which was recently fixed:
https://savannah.nongnu.org/bugs/?19079

Eric Weddington <arcanum>
Group administrator
Fri 14 Mar 2008 06:01:59 PM UTC, comment #1: 

Forgot to mention the version of avr-libc was 1.4.6

brent sirna <bsirna>
Fri 14 Mar 2008 05:58:00 PM UTC, original submission:  

The following code illustrates the bug.

    char
        s1[5],
        s2[5];

    int
        result;

    s1[0] = 0;
    s2[0] = 0;
    result = sscanf_P( ",ABCD,EFGH,", PSTR( ",%4s,%4s," ), &s1, &s2 );
    printf_P( PSTR( "%d %s %s\r\n" ), result, s1, s2 );

    s1[0] = 0;
    s2[0] = 0;
    result = sscanf_P( ",ABCD,EFGH,", PSTR( ",%3s,%3s," ), &s1, &s2 );
    printf_P( PSTR( "%d %s %s\r\n" ), result, s1, s2 );

results from executing this code.

1 ABCD
2 ABC EFG

Had a quick look at the code and I believe the problem is that when the loop is exited in the case statement for the 's' one extra character has been removed from the stream;

Best regards

Brent


brent sirna <bsirna>

 

(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

 

Carbon-Copy List
  • -email is unavailable- added by dmix (Posted a comment)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by bsirna (Submitted the item)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-03-18 arcanum Open/ClosedOpen Closed
    2008-03-18 dmix StatusNone Duplicate
        Percent Complete0% 100%
        Assigned toNone dmix

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code