Merge branch 'maint-0.2.9' into maint-0.3.1

This commit is contained in:
Nick Mathewson 2018-03-27 18:23:53 -04:00
commit 5acfc30876
2 changed files with 9 additions and 7 deletions

3
changes/bug25629 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (C correctness):
- Fix a very unlikely null pointer dereference. Fixes bug 25629;
bugfix on 0.2.9.15. Found by Coverity; this is CID 1430932.

View File

@ -291,13 +291,12 @@ nodelist_add_microdesc(microdesc_t *md)
if (rs == NULL) if (rs == NULL)
return NULL; return NULL;
node = node_get_mutable_by_id(rs->identity_digest); node = node_get_mutable_by_id(rs->identity_digest);
if (node) { if (node == NULL)
if (node->md) return NULL;
node->md->held_by_nodes--; if (node->md)
node->md = md; node->md->held_by_nodes--;
md->held_by_nodes++; node->md = md;
} md->held_by_nodes++;
node_add_to_address_set(node); node_add_to_address_set(node);
return node; return node;