[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #43442] sprintf function incorrectly interprets form
From: |
anonymous |
Subject: |
[avr-libc-dev] [bug #43442] sprintf function incorrectly interprets format parameters |
Date: |
Sun, 19 Oct 2014 22:00:13 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 |
URL:
<http://savannah.nongnu.org/bugs/?43442>
Summary: sprintf function incorrectly interprets format
parameters
Project: AVR C Runtime Library
Submitted by: None
Submitted on: Sun 19 Oct 2014 10:00:12 PM UTC
Category: Library
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: libc code
Status: None
Percent Complete: 0%
Assigned to: None
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 1.8.0
Fixed Release: None
_______________________________________________________
Details:
Function sprintf incorrectly interprets passed parameters, on following
example:
char someString[3];
uint8_t number = 0;
number = 9;
sprintf(someString, "%02u", number);
Now in someString we will have 09 but when we do this:
number = 10;
sprintf(someString, "%02u", number);
Then in someString we have 16, not 10 as we expect. But when we change format
from "%02u" to "%02x" then it works fine, and we have 10 in someString. Of
course with values 20, 30 and so on problem also exist. From what I can see,
this function interpret %u as hex(10 in HEX is 16 in DEC) and %x as decimal
but it should be interpreted inversely.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?43442>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [avr-libc-dev] [bug #43442] sprintf function incorrectly interprets format parameters,
anonymous <=