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

 
 

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

Submitted by:  brent sirna <bsirna>
Submitted on:  Fri 14 Mar 2008 05:58:00 PM UTC  
 
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: DuplicatePercent Complete: 100%
Assigned to: Dmitry Xmelkov <dmix>Open/Closed: Closed
Release: NoneFixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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

This is duplicate of bug #19079: was fixed.

Dmitry Xmelkov <dmix>
Project AdministratorIn charge of this item.
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>
Project 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>
Project 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.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 18 Mar 2008 11:26:14 PM UTCarcanumOpen/ClosedOpen=>Closed
    Tue 18 Mar 2008 01:37:03 PM UTCdmixStatusNone=>Duplicate
      Percent Complete0%=>100%
      Assigned toNone=>dmix

    Back to the top


    Powered by Savane 3.1-cleanup1