]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use memset() on intro1_data in hs_circ_send_introduce1()
authorNeel Chauhan <neel@neelc.org>
Thu, 16 Nov 2017 17:58:37 +0000 (12:58 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 17 Nov 2017 13:42:07 +0000 (08:42 -0500)
src/or/hs_circuit.c

index 9e7709504bd477b61a382b6e36bb595cae524344..7f5bbdaaf4cffaaec7f438421d1e0788a5ac6f5d 100644 (file)
@@ -1101,6 +1101,11 @@ hs_circ_send_introduce1(origin_circuit_t *intro_circ,
   tor_assert(ip);
   tor_assert(subcredential);
 
+  /* It is undefined behavior in hs_cell_introduce1_data_clear() if intro1_data
+   * has been declared on the stack but not initialized. Here, we set it to 0.
+   */
+  memset(&intro1_data, 0, sizeof(hs_cell_introduce1_data_t));
+
   /* This takes various objects in order to populate the introduce1 data
    * object which is used to build the content of the cell. */
   const node_t *exit_node = build_state_get_exit_node(rend_circ->build_state);