lldpd / lldpd

implementation of IEEE 802.1ab (LLDP)
https://lldpd.github.io
Other
604 stars 178 forks source link

chance for a segfault #640

Closed kanna-uk closed 6 months ago

kanna-uk commented 6 months ago

Hi Vincent, https://github.com/lldpd/lldpd/commit/aa6e92977681a8816718c1b1e820b9b415d36a2a

if (hardware->h_ifdescr_previous == NULL || strcmp(hardware->h_ifdescr_previous, description)) { priv_iface_description(hardware->h_ifname, description); free(hardware->h_ifdescr_previous); hardware->h_ifdescr_previous = description; } else free(description); assume hardware->h_ifdescr_previous = NULL , then it will enter the loop and it is getting free-----> segfault pls take care

vincentbernat commented 6 months ago

free(NULL) is a noop as per standard.