Commit 4bb7d9fd authored by Taylor Yu's avatar Taylor Yu
Browse files

Fix CID 1430932

Coverity found a null pointer reference in nodelist_add_microdesc().
This is almost certainly impossible assuming that the routerstatus_t
returned by router_get_consensus_status_by_descriptor_digest() always
corresponds to an entry in the nodelist.  Fixes bug 25629.
parent 9f93bcd1
Loading
Loading
Loading
Loading

changes/bug25629

0 → 100644
+3 −0
Original line number Diff line number Diff line
  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.
+6 −7
Original line number Diff line number Diff line
@@ -263,13 +263,12 @@ nodelist_add_microdesc(microdesc_t *md)
  if (rs == NULL)
    return NULL;
  node = node_get_mutable_by_id(rs->identity_digest);
  if (node) {
  if (node == NULL)
    return NULL;
  if (node->md)
    node->md->held_by_nodes--;
  node->md = md;
  md->held_by_nodes++;
  }

  node_add_to_address_set(node);

  return node;