intel / openlldp

Other
54 stars 43 forks source link

lldptool: fix null pointer deference #88

Closed gaoxingwang closed 2 years ago

gaoxingwang commented 2 years ago

fix https://github.com/intel/openlldp/issues/87

gaoxingwang commented 2 years ago

PTAL @orgcandman

apconole commented 2 years ago

How did you generate this error? I assume that if an issue occurs during weak_readline_init then the rl_handle variable is reinitialized to NULL. Were you able to reproduce?

I think there is room for cleanup, but I'm curious if this is cleanup or if you observed a real issue here (which would point to some kind of race condition).

gaoxingwang commented 2 years ago

How did you generate this error? I assume that if an issue occurs during weak_readline_init then the rl_handle variable is reinitialized to NULL. Were you able to reproduce?

Yes, on my linux virtual machine, this problem is a constant occurrence. Function weak_readline_init fails here,and the rl_handle variable is NULL.

    hist_handle = dlopen("libhistory.so", RTLD_LAZY | RTLD_GLOBAL);                                                                                                                                               
    if (!hist_handle)
        return;
apconole commented 2 years ago

Thanks!