aboutsummaryrefslogtreecommitdiff
path: root/src/multicast
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2018-02-28 18:38:38 +0100
committert3sserakt <t3ss@posteo.de>2018-02-28 18:39:04 +0100
commitb81feeba28ea00a99028be94248648d0254c56a7 (patch)
tree32592725552aadcacf04943d62d8a7e81cac2a56 /src/multicast
parent56a9d4001b0844287ecc55b103549370676646a8 (diff)
downloadgnunet-b81feeba28ea00a99028be94248648d0254c56a7.tar.gz
gnunet-b81feeba28ea00a99028be94248648d0254c56a7.zip
fixed inverted greater-than less-than
Diffstat (limited to 'src/multicast')
-rw-r--r--src/multicast/gnunet-service-multicast.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index 819212388..e66bacddb 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -1450,9 +1450,11 @@ check_client_member_join (void *cls,
1450 uint16_t msg_size = ntohs (msg->header.size); 1450 uint16_t msg_size = ntohs (msg->header.size);
1451 struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; 1451 struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1];
1452 uint32_t relay_count = ntohl (msg->relay_count); 1452 uint32_t relay_count = ntohl (msg->relay_count);
1453 if (UINT32_MAX / relay_count > sizeof (*relays)){ 1453 if (UINT32_MAX / relay_count < sizeof (*relays)){
1454 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1454 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1455 "relay_size exceeds UINT32_MAX!"); 1455 "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n",
1456 (unsigned long)relay_count,
1457 sizeof (*relays));
1456 return GNUNET_SYSERR; 1458 return GNUNET_SYSERR;
1457 } 1459 }
1458 uint32_t relay_size = relay_count * sizeof (*relays); 1460 uint32_t relay_size = relay_count * sizeof (*relays);
@@ -1464,15 +1466,17 @@ check_client_member_join (void *cls,
1464 join_msg = (struct GNUNET_MessageHeader *) 1466 join_msg = (struct GNUNET_MessageHeader *)
1465 (((char *) &msg[1]) + relay_size); 1467 (((char *) &msg[1]) + relay_size);
1466 join_msg_size = ntohs (join_msg->size); 1468 join_msg_size = ntohs (join_msg->size);
1467 if (UINT16_MAX - join_msg_size > sizeof (struct MulticastJoinRequestMessage)){ 1469 if (UINT16_MAX - join_msg_size < sizeof (struct MulticastJoinRequestMessage)){
1468 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1470 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1469 "join_msg_size exceeds UINT16_MAX!"); 1471 "join_msg_size (%u) + sizeof (struct MulticastJoinRequestMessage) (%lu) exceeds UINT16_MAX!\n",
1472 (unsigned)join_msg_size,
1473 (unsigned long)sizeof (struct MulticastJoinRequestMessage));
1470 return GNUNET_SYSERR; 1474 return GNUNET_SYSERR;
1471 } 1475 }
1472 } 1476 }
1473 if (msg_size != (sizeof (*msg) + relay_size + join_msg_size)){ 1477 if (msg_size != (sizeof (*msg) + relay_size + join_msg_size)){
1474 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1478 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1475 "msg_size does not match real size of message!"); 1479 "msg_size does not match real size of message!\n");
1476 return GNUNET_SYSERR; 1480 return GNUNET_SYSERR;
1477 }else{ 1481 }else{
1478 return GNUNET_OK; 1482 return GNUNET_OK;