explicitly setting rte->next = null

Ondrej Zajicek santiago at crfreenet.org
Wed Aug 20 09:37:38 CEST 2014


On Wed, Aug 20, 2014 at 05:44:28PM +1200, Nic Cave-Lynch wrote:
> 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.

Generally, rte->next should be set by rte_recalculate() when it is
inserted to the routing table and should not be accessed before that.
If this causes crash to you, it is probably some other problem in
the update path. What are the circumstances when your code accessed
rte->next value? It was called regularly from rte_announce()?

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20140820/07793049/attachment-0001.asc>


More information about the Bird-users mailing list