explicitly setting rte->next = null

Nic Cave-Lynch nic at cvgenie.com
Wed Aug 20 07:44:28 CEST 2014


Hi People

I've been trying to find a segfault in a custom protocol I've been  
writing. I've finally tracked it down to a situation where bgp protocol,  
in bgp_rte_update, is calling rte_get_temp but not setting -> next to  
null, leaving it at whatever was left in RAM when the memory was  
allocated. Later, I see it's not null and try to access the ->next and  
eventually trigger a segfault.

I've looked at the code and I can't see any reason why ->next shouldn't be  
set to null. So, does anyone know if this is going to cause problems later?

The attached patch implements my change. I wonder if it might be better to  
explicitly set the rte pointed to by rte_get_temp to zero before using and  
returning it. I didn't want to make that change in case there are really  
good reasons why not.

Cheers

Nic C-L
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bgp_set_next_after_rte_get_temp.patch
Type: application/octet-stream
Size: 352 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20140820/ee8da103/attachment.obj>


More information about the Bird-users mailing list