aboutsummaryrefslogtreecommitdiff
path: root/src/multicast/gnunet-service-multicast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/multicast/gnunet-service-multicast.c')
-rw-r--r--src/multicast/gnunet-service-multicast.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index e66bacddb..f8441cc2b 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009 GNUnet e.V. 3 Copyright (C) 2009 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
@@ -1450,12 +1448,16 @@ check_client_member_join (void *cls,
1450 uint16_t msg_size = ntohs (msg->header.size); 1448 uint16_t msg_size = ntohs (msg->header.size);
1451 struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; 1449 struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1];
1452 uint32_t relay_count = ntohl (msg->relay_count); 1450 uint32_t relay_count = ntohl (msg->relay_count);
1453 if (UINT32_MAX / relay_count < sizeof (*relays)){ 1451
1454 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1452 if (0 != relay_count)
1455 "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n", 1453 {
1456 (unsigned long)relay_count, 1454 if (UINT32_MAX / relay_count < sizeof (*relays)){
1457 sizeof (*relays)); 1455 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1458 return GNUNET_SYSERR; 1456 "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n",
1457 (unsigned long)relay_count,
1458 sizeof (*relays));
1459 return GNUNET_SYSERR;
1460 }
1459 } 1461 }
1460 uint32_t relay_size = relay_count * sizeof (*relays); 1462 uint32_t relay_size = relay_count * sizeof (*relays);
1461 struct GNUNET_MessageHeader *join_msg = NULL; 1463 struct GNUNET_MessageHeader *join_msg = NULL;