[BusyBox] Bug in xconnect.c v.1.00-pre4

Simon Dunn sdunn at mpc-data.co.uk
Tue Dec 23 15:49:14 UTC 2003


Hi,

I've recently been doing some development work using version 1.00-pre4
and noticed that the previously well behaved telnet client stopped
working.

I've tracked this bug to the following line of code in the function
bb_getport() at line 30 in xconnect.c:
.
.
.

port_nr=strtol(port, &endptr, 10);
if (errno != 0 || *endptr!='\0' || endptr==port || port_nr < 1 || port_nr 
> 65536)
{

.
.
.

The problem is with using errno to check that something has succeeded. In 
my
world a file had failed to open prior to this 'strtol()' function call so 
errno
was still set to ENOENT.

So bb_getport returned an invalid port number which telnet unsurprisingly 
failed to
connect on.

Simon Dunn

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/



More information about the busybox mailing list