[BusyBox] Serious bug in udhcpc
Russ Dill
Russ.Dill at asu.edu
Mon Apr 21 05:00:14 UTC 2003
> I found your problem. Please define timeout just "long" and not
> "unsigned long". In line 335 instead of receiving negative value
> you receive a huge positive value.
>
> Check out the following code:
>
> static unsigned long timeout;
> struct timeval tv;
> int main()
> {
> printf("timeout is %ld, ", timeout);
> tv.tv_sec = timeout - time(0);
> printf("tv.tv_sec is %ld\n", tv.tv_sec);
> }
>
> Here are results on Intel:
> timeout is 0, tv.tv_sec is -1050899824
ok, which is correct.
> Here are results on PPC:
> timeout is 0, tv.tv_sec is 1645163368
thats a positive value (620F3368), which would come from a possibly
incorrect value for time(0). It would seem to me if it can't subtract a
long from an unsigned long and store the answer in a long, there are
problems.
> And just as off topic question - why just not to call send_discover
> as first thing when you start program ??
because that would complicate the code.
More information about the busybox
mailing list