[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Fix a few coverity unitinitialzed-value warnings in the unit tests.
commit 68792f77e51f84d0fb6758ef9491a70570ac9a53
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri Jun 28 12:21:49 2019 -0400
Fix a few coverity unitinitialzed-value warnings in the unit tests.
Coverity can't see that it is not in fact going to read
uninitialized memory here, so we initialize these values
unconditionally.
Bugfix on 0.4.0.1-alpha.
---
src/test/test_btrack.c | 4 ++++
src/test/test_controller_events.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/src/test/test_btrack.c b/src/test/test_btrack.c
index 9e5d0d072..21e88a57b 100644
--- a/src/test/test_btrack.c
+++ b/src/test/test_btrack.c
@@ -44,6 +44,8 @@ test_btrack_launch(void *arg)
{
orconn_state_msg_t conn;
ocirc_chan_msg_t circ;
+ memset(&conn, 0, sizeof(conn));
+ memset(&circ, 0, sizeof(circ));
(void)arg;
conn.gid = 1;
@@ -93,6 +95,8 @@ test_btrack_delete(void *arg)
{
orconn_state_msg_t state;
orconn_status_msg_t status;
+ memset(&state, 0, sizeof(state));
+ memset(&status, 0, sizeof(status));
(void)arg;
state.gid = 1;
diff --git a/src/test/test_controller_events.c b/src/test/test_controller_events.c
index a8967bba5..9fb2bc725 100644
--- a/src/test/test_controller_events.c
+++ b/src/test/test_controller_events.c
@@ -429,6 +429,7 @@ static void
test_cntev_orconn_state(void *arg)
{
orconn_state_msg_t conn;
+ memset(&conn, 0, sizeof(conn));
(void)arg;
MOCK(queue_control_event_string, mock_queue_control_event_string);
@@ -468,6 +469,7 @@ static void
test_cntev_orconn_state_pt(void *arg)
{
orconn_state_msg_t conn;
+ memset(&conn, 0, sizeof(conn));
(void)arg;
MOCK(queue_control_event_string, mock_queue_control_event_string);
@@ -503,6 +505,7 @@ static void
test_cntev_orconn_state_proxy(void *arg)
{
orconn_state_msg_t conn;
+ memset(&conn, 0, sizeof(conn));
(void)arg;
MOCK(queue_control_event_string, mock_queue_control_event_string);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits