[btnode-development] Re: [En-Nut-Discussion] Bug in timer.c?

Matthias Ringwald mringwal at inf.ethz.ch
Tue Jul 12 16:24:25 CEST 2005


Hi ole

ups, your right.

>
> At line 324 you add tn_ticks_left to the next timer in the list but
> don't check if it exists. If you reached the last timer in the list,
> this will overwrite some random address in the memeory on avr or
> segfault on unix.
>
> My approach would be:
>
> if (nexttn->tn_next != NULL) {
>   nexttn->tn_next->tn_ticks_left += nexttn->tn_ticks_left; // line 324
> }
>
> Would this be ok or would this have any side effects?

yes.. thanks for hunting. just go ahead and check it into cvs.
the routine was already a kind of fix, but not checking for NULL (aua..)

matthias



More information about the En-Nut-Discussion mailing list