Skip to content
Snippets Groups Projects
Commit aa956116 authored by David Goulet's avatar David Goulet :panda_face:
Browse files

nodelist: Fix possible NULL deref


Found by coverity with CID 1465290. Fix unreleased code.

Fixes #40049

Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
parent 4b24b362
Branches
Tags
No related merge requests found
......@@ -1988,6 +1988,12 @@ node_set_country(node_t *node)
else if (node->ri)
ipv4_addr = &node->ri->ipv4_addr;
/* IPv4 is mandatory for a relay so this should not happen unless we are
* attempting to set the country code on a node without a descriptor. */
if (BUG(!ipv4_addr)) {
node->country = -1;
return;
}
node->country = geoip_get_country_by_addr(ipv4_addr);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment