Segment Fault in find_route
Walrath, Paul (Vancouver)
Sat Apr 11 00:24:04 2015
Hi Roy,
I've been seeing an occasional segment fault in the find_route() function. In the following code, a zero value pointer is being dereferenced.
#ifdef HAVE_ROUTE_METRIC
(srt || (!rt->iface ||
rt->iface->metric == r->iface->metric)) &&
#endif
The r->iface value is 0, so r->iface->metric is causing the segment fault. This would be avoided by the following:
#ifdef HAVE_ROUTE_METRIC
(srt || (!rt->iface || !r->iface ||
rt->iface->metric == r->iface->metric)) &&
#endif
This is similar to what is implemented in find_route6()
#ifdef HAVE_ROUTE_METRIC
(r->iface == NULL || rt->iface == NULL ||
rt->iface->metric == r->iface->metric) &&
#endif
Does this look right to you? I don't have any idea if this breaks the logic in the function.
I am looking at trunk source code which I cloned last week. I hope it's not too far out of date.
Paul Walrath
Hewlett-Packard
Archive administrator: postmaster@marples.name