[uClibc] null pointer dereferenced in ldso/libdl/dlibc.c

Doru Petrescu pdoru at kappa.ro
Mon Jan 19 20:52:22 UTC 2004



Hi everybody,

take a look at this code, I found a NULL pointer that is derefenced
producing a sigmentation fault

file ldso/libdl/dlibc.c, line 290

>
>       /* Notify the debugger we have added some objects. */
>        _dl_debug_addr->r_state = RT_ADD;
>        if (_dl_debug_addr) {
>                dl_brk = (void (*)(void)) _dl_debug_addr->r_brk;
>                if (dl_brk != NULL) {
>                        _dl_debug_addr->r_state = RT_ADD;
>                        (*dl_brk) ();
>                                                                                                   > 
>                        _dl_debug_addr->r_state = RT_CONSISTENT;
>                        (*dl_brk) ();
>                }
>        }
>

Notice that it will check if the pointer is NULL __AFTER__ it uses it.
interesting isn't it ?

how to fix it:
not sure, but I just move that line inside the if, and it works just
great! 


but, my question is ... this code actualy works in some conditions ?
maybe with a debuger ?

please reply to me directly, i am not on the list.




-- 


Best regards,
Doru Petrescu
Senior Software Engineer
Astral Telecom Bucuresti
                                                                                                    







More information about the uClibc mailing list