View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001685 | GNUnet | public | 2011-06-05 18:49 | 2011-06-10 11:09 | |
| Reporter | Christian Grothoff | Assigned To | vminko | ||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | closed | Resolution | fixed | ||
| Summary | 0001685: uninitialized message fields somewhere in chat code | ||||
| Description | When running $ valgrind --trace-children=yes .libs/lt-test_chat_private_p2p against SVN 15431, I get a warning about uninitialized bytes being passed to 'send'. This typically happens if some members of some message struct (often unused ones) are not initialized by the code prior to transmission. | ||||
| Additional Information | ==8882== Syscall param socketcall.send(msg) points to uninitialised byte(s) ==8882== at 0x4169F61: send (socket.S:64) ==8882== by 0x4046051: transmit_ready (connection.c:1561) ==8882== by 0x405E50F: run_ready (scheduler.c:643) ==8882== by 0x405EAF0: GNUNET_SCHEDULER_run (scheduler.c:790) ==8882== by 0x405AF18: GNUNET_PROGRAM_run (program.c:227) ==8882== by 0x8049ED3: main (test_chat_private.c:675) ==8882== Address 0x4588de4 is 12 bytes inside a block of size 342 alloc'd ==8882== at 0x402695A: realloc (vg_replace_malloc.c:525) ==8882== by 0x403FA8D: GNUNET_xrealloc_ (common_allocation.c:167) ==8882== by 0x4045EFD: transmit_ready (connection.c:1546) ==8882== by 0x405E50F: run_ready (scheduler.c:643) ==8882== by 0x405EAF0: GNUNET_SCHEDULER_run (scheduler.c:790) ==8882== by 0x405AF18: GNUNET_PROGRAM_run (program.c:227) ==8882== by 0x8049ED3: main (test_chat_private.c:675) | ||||
| Tags | No tags attached. | ||||
| Attached Files | gnunet-bug1685-fix.patch (2,947 bytes)
Index: chat.c
===================================================================
--- chat.c (revision 15446)
+++ chat.c (working copy)
@@ -187,8 +187,9 @@
receipt->header.size = htons (msg_size);
receipt->header.type =
htons (GNUNET_MESSAGE_TYPE_CHAT_CONFIRMATION_RECEIPT);
+ receipt->reserved = htonl (0);
receipt->sequence_number = src->received_msg->sequence_number;
- receipt->reserved2 = 0;
+ receipt->reserved2 = htonl (0);
receipt->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
GNUNET_CRYPTO_rsa_key_get_public (src->chat_room->my_private_key, &pub_key);
GNUNET_CRYPTO_hash (&pub_key,
@@ -565,6 +566,7 @@
join_msg->msg_options = htonl (chat_room->msg_options);
join_msg->room_name_len = htons (room_len);
join_msg->reserved = htons (0);
+ join_msg->reserved2 = htonl (0);
GNUNET_CRYPTO_rsa_key_get_public (chat_room->my_private_key, &join_msg->public_key);
room = (char *) &join_msg[1];
memcpy (room, chat_room->room_name, room_len);
Index: gnunet-service-chat.c
===================================================================
--- gnunet-service-chat.c (revision 15446)
+++ gnunet-service-chat.c (working copy)
@@ -474,7 +474,7 @@
p2p_rnmsg->msg_options = trmsg->msg_options;
p2p_rnmsg->sequence_number = trmsg->sequence_number;
p2p_rnmsg->timestamp = trmsg->timestamp;
- p2p_rnmsg->reserved = 0;
+ p2p_rnmsg->reserved = htons (0);
p2p_rnmsg->sender = rnmsg->sender;
p2p_rnmsg->target = trmsg->target;
if (is_anon)
@@ -523,6 +523,7 @@
m->msg_options = htonl (entry->msg_options);
m->room_name_len = htons (room_len);
m->reserved = htons (0);
+ m->reserved2 = htonl (0);
m->public_key = entry->public_key;
roomptr = (char *) &m[1];
memcpy (roomptr, entry->room, room_len);
@@ -826,6 +827,7 @@
p2p_crmsg = GNUNET_malloc (sizeof (struct P2PConfirmationReceiptMessage));
p2p_crmsg->header.size = htons (sizeof (struct P2PConfirmationReceiptMessage));
p2p_crmsg->header.type = htons (GNUNET_MESSAGE_TYPE_CHAT_P2P_CONFIRMATION_RECEIPT);
+ p2p_crmsg->reserved = htonl (0);
p2p_crmsg->signature = receipt->signature;
p2p_crmsg->purpose = receipt->purpose;
p2p_crmsg->msg_sequence_number = receipt->sequence_number;
@@ -909,7 +911,7 @@
m = buf;
m->header.type = htons (GNUNET_MESSAGE_TYPE_CHAT_P2P_LEAVE_NOTIFICATION);
m->header.size = htons (msg_size);
- m->reserved = htons (0);
+ m->reserved = htonl (0);
m->user = *public_key;
GNUNET_free (public_key);
return msg_size;
@@ -1336,6 +1338,7 @@
rnmsg->header.type = htons (GNUNET_MESSAGE_TYPE_CHAT_MESSAGE_NOTIFICATION);
rnmsg->msg_options = p2p_rnmsg->msg_options;
rnmsg->sequence_number = p2p_rnmsg->sequence_number;
+ rnmsg->reserved = htonl (0);
rnmsg->timestamp = p2p_rnmsg->timestamp;
is_priv = (0 != memcmp (&all_zeros,
&p2p_rnmsg->target, sizeof (GNUNET_HashCode)));
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2011-06-05 18:49 | Christian Grothoff | New Issue | |
| 2011-06-05 18:50 | Christian Grothoff | Assigned To | => vminko |
| 2011-06-05 18:50 | Christian Grothoff | Status | new => assigned |
| 2011-06-05 18:50 | Christian Grothoff | Category | other => chat service |
| 2011-06-07 16:15 | vminko | File Added: gnunet-bug1685-fix.patch | |
| 2011-06-07 16:15 | vminko | Note Added: 0004345 | |
| 2011-06-10 11:06 | Christian Grothoff | Note Added: 0004350 | |
| 2011-06-10 11:06 | Christian Grothoff | Status | assigned => resolved |
| 2011-06-10 11:06 | Christian Grothoff | Resolution | open => fixed |
| 2011-06-10 11:09 | Christian Grothoff | Status | resolved => closed |
| 2013-08-31 21:34 | Christian Grothoff | Category | chat service => (No Category) |