diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-07-02 16:03:08 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-07-02 16:03:08 +0000 |
commit | 977c4ed7fefc4cd15d2896662e73da8fcc9c32c3 (patch) | |
tree | 5a5e7cfba7da1dc5bf7b2dec0c73f2872a4def58 /src/dv | |
parent | 29cf3c9a615e5af2192a10055988434bc5abbe41 (diff) | |
download | gnunet-977c4ed7fefc4cd15d2896662e73da8fcc9c32c3.tar.gz gnunet-977c4ed7fefc4cd15d2896662e73da8fcc9c32c3.zip |
codesonar fixes
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/dv.h | 7 | ||||
-rw-r--r-- | src/dv/dv_api.c | 5 | ||||
-rw-r--r-- | src/dv/gnunet-service-dv.c | 1 |
3 files changed, 3 insertions, 10 deletions
diff --git a/src/dv/dv.h b/src/dv/dv.h index bb63bc004..cc335b2e6 100644 --- a/src/dv/dv.h +++ b/src/dv/dv.h | |||
@@ -64,7 +64,7 @@ struct GNUNET_DV_MessageReceived | |||
64 | struct GNUNET_PeerIdentity sender; | 64 | struct GNUNET_PeerIdentity sender; |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * The message that was sent | 67 | * The length of the message that was sent (appended to this end of struct) |
68 | */ | 68 | */ |
69 | uint32_t msg_len; | 69 | uint32_t msg_len; |
70 | 70 | ||
@@ -73,11 +73,6 @@ struct GNUNET_DV_MessageReceived | |||
73 | */ | 73 | */ |
74 | uint32_t distance; | 74 | uint32_t distance; |
75 | 75 | ||
76 | /** | ||
77 | * Length of the sender address, appended to end of this message | ||
78 | */ | ||
79 | uint32_t sender_address_len; | ||
80 | |||
81 | }; | 76 | }; |
82 | 77 | ||
83 | 78 | ||
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c index e5713cdda..d9aef03c8 100644 --- a/src/dv/dv_api.c +++ b/src/dv/dv_api.c | |||
@@ -367,9 +367,8 @@ void handle_message_receipt (void *cls, | |||
367 | 367 | ||
368 | received_msg = (struct GNUNET_DV_MessageReceived *)msg; | 368 | received_msg = (struct GNUNET_DV_MessageReceived *)msg; |
369 | packed_msg_len = ntohl(received_msg->msg_len); | 369 | packed_msg_len = ntohl(received_msg->msg_len); |
370 | sender_address_len = ntohl(received_msg->sender_address_len); | 370 | sender_address_len = ntohs(msg->size) - packed_msg_len - sizeof(struct GNUNET_DV_MessageReceived); |
371 | 371 | GNUNET_assert(sender_address_len > 0); | |
372 | GNUNET_assert(ntohs(msg->size) == (sizeof(struct GNUNET_DV_MessageReceived) + packed_msg_len + sender_address_len)); | ||
373 | sender_address = GNUNET_malloc(sender_address_len); | 372 | sender_address = GNUNET_malloc(sender_address_len); |
374 | memcpy(sender_address, &received_msg[1], sender_address_len); | 373 | memcpy(sender_address, &received_msg[1], sender_address_len); |
375 | packed_msg_start = (char *)&received_msg[1]; | 374 | packed_msg_start = (char *)&received_msg[1]; |
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 4bb6555d3..84dc84965 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -814,7 +814,6 @@ void send_to_plugin(const struct GNUNET_PeerIdentity * sender, | |||
814 | received_msg = GNUNET_malloc(size); | 814 | received_msg = GNUNET_malloc(size); |
815 | received_msg->header.size = htons(size); | 815 | received_msg->header.size = htons(size); |
816 | received_msg->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_DV_RECEIVE); | 816 | received_msg->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_DV_RECEIVE); |
817 | received_msg->sender_address_len = htonl(sender_address_len); | ||
818 | received_msg->distance = htonl(cost); | 817 | received_msg->distance = htonl(cost); |
819 | received_msg->msg_len = htonl(message_size); | 818 | received_msg->msg_len = htonl(message_size); |
820 | /* Set the sender in this message to be the original sender! */ | 819 | /* Set the sender in this message to be the original sender! */ |