Bug in _scanf.c

Pirmin Walthert infos at nappsoft.com
Sat Mar 23 13:36:50 UTC 2013


On 03/22/2013 09:14 PM, Bernhard Reutner-Fischer wrote:
> On 18 March 2013 09:55:08 Pirmin Walthert <infos at nappsoft.com> wrote:
>> Hello
>>
>> It seems like commit e567c399ff86d007d8c4586f0dd5e0ca61e283ca
>> <http://git.uclibc.org/uClibc/commit/?h=0.9.33&id=e567c399ff86d007d8c4586f0dd5e0ca61e283ca> 
>>
>> had introduced a bug into _scanf.c.
>
> I believe that Nathans patch applied to master by Bernd fixes this. I 
> will put it on the 0.9.33 branch shortly.
> Thanks,
>
>
> Sent with AquaMail for Android
> http://www.aqua-mail.com
>
>
Hello

No sorry, it doesn't fix this bug. I've just recompiled everything 
(9a7b71facfcaee5f3a45429358c55fcd5377c509, patched with Nathan's patch 
and mine removed) and I get back the old behavior.

This is for example my netstat output:

tcp        0      0 0.0.0.0:4128            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:10050           0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:2020            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:3333            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:11              0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5038            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5555            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:53              0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5080            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:3128            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:3129            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5050            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:443             0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:1723            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:1723            0.0.0.0:60104 ESTABLISHED
tcp        0    208 0.0.0.0:2020            0.0.0.0:34062 ESTABLISHED
tcp        0      0 0.0.0.0:2020            0.0.0.0:33960 ESTABLISHED
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:53 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:67 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:69 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:123 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:1194 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
udp        0      0 ::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:5060 
::9ce4:b6bf:ece4:b6bf:a8e4:b6bf:*
netstat: /proc/net/udp6: No such file or directory
raw        0      0 ::a0e4:b6bf:f0e4:b6bf:ace4:b6bf:1 
::a0e4:b6bf:f0e4:b6bf:ace4:b6bf:* 1
raw        0      0 ::a0e4:b6bf:f0e4:b6bf:ace4:b6bf:47 
::a0e4:b6bf:f0e4:b6bf:ace4:b6bf:* 47

=> IP's won't be read (see the last 3 tcp lines) and the udp output is 
garbage.

This has definitely to do with the changes introduced with 
e567c399ff86d007d8c4586f0dd5e0ca61e283ca (found this out with 
git-bisecting) and can be fixed with my patch (I know, there might be 
"simpler" ways/shorter patches to fix this, I just tried to restore the 
old behavior (before e567c399ff86d007d8c4586f0dd5e0ca61e283ca) with 
keeping the intended functional changes and without digging to deep into 
the complete _scanf code. I'm sorry that I didn't spend any time with 
writing a testcase, but buggy outputs of programs relying on scanf is 
enough I guess.

Here an output from the same system with my patch applied:

~ # netstat -na
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address State
tcp        0      0 0.0.0.0:4128            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:10050           0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:2020            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:3333            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:11              0.0.0.0:* LISTEN
tcp        0      0 127.0.0.1:5038          0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5555            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:53              0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5080            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:3128            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:3129            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:5050            0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:443             0.0.0.0:* LISTEN
tcp        0      0 0.0.0.0:1723            0.0.0.0:* LISTEN
tcp        0      0 77.58.32.53:34724       94.198.255.212:3328 TIME_WAIT
tcp        0      0 77.58.32.53:1723        213.200.236.234:60115 
ESTABLISHED
tcp        0    208 192.168.240.12:2020     192.168.240.184:34354 
ESTABLISHED
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 0.0.0.0:53 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:67 0.0.0.0:*
udp        0      0 0.0.0.0:69 0.0.0.0:*
udp        0      0 0.0.0.0:123 0.0.0.0:*
udp        0      0 0.0.0.0:1194 0.0.0.0:*
udp        0      0 127.0.0.1:5566 0.0.0.0:*
udp        0      0 0.0.0.0:5060 0.0.0.0:*
netstat: /proc/net/udp6: No such file or directory
raw        0      0 77.58.32.53:47          213.200.236.234:* 47
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING       4098 
/var/cache/pdnsd.status
unix  2      [ ACC ]     STREAM     LISTENING       3590 /tmp/php.socket-0
unix  2      [ ACC ]     STREAM     LISTENING       3594 /tmp/php.socket-1
unix  2      [ ]         DGRAM                      2836 
/var/run/hostapd/wlan0
unix  2      [ ACC ]     STREAM     LISTENING       3705 
/var/run/callweaver.ctl
unix  11     [ ]         DGRAM                      2505 /dev/log
unix  2      [ ]         DGRAM                      3662
unix  2      [ ]         DGRAM                      3659
unix  2      [ ]         DGRAM                      3574
unix  2      [ ]         DGRAM                      3568
unix  2      [ ]         DGRAM                      3017
unix  2      [ ]         DGRAM                      2738
unix  2      [ ]         DGRAM                      2733
unix  2      [ ]         DGRAM                      2658
unix  2      [ ]         DGRAM                      2510


Regards, Pirmin



More information about the uClibc mailing list