diff options
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 4323be478..2f56ff2bd 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2004, 2005, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001, 2002, 2004, 2005, 2007, 2009, 2010 Christian Grothoff (and other contributing authors) |
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 |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -181,9 +181,11 @@ transmit_pending_notification (void *cls, | |||
181 | next = nl->pending; | 181 | next = nl->pending; |
182 | pos = nl->pending; | 182 | pos = nl->pending; |
183 | left = size; | 183 | left = size; |
184 | while ( (pos != NULL) && | 184 | while (pos != NULL) |
185 | (left >= sizeof (struct InfoMessage) + (hs = GNUNET_HELLO_size (pos->he->hello))) ) | ||
186 | { | 185 | { |
186 | hs = (pos->he->hello == NULL) ? 0 : GNUNET_HELLO_size (pos->he->hello); | ||
187 | if (left < sizeof (struct InfoMessage) + hs) | ||
188 | break; | ||
187 | next = pos->next; | 189 | next = pos->next; |
188 | im.header.size = htons (hs + sizeof (struct InfoMessage)); | 190 | im.header.size = htons (hs + sizeof (struct InfoMessage)); |
189 | im.header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); | 191 | im.header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); |
@@ -225,6 +227,7 @@ do_notify (struct NotifyList *nl, | |||
225 | struct HostEntry *he) | 227 | struct HostEntry *he) |
226 | { | 228 | { |
227 | struct PendingEntry *pe; | 229 | struct PendingEntry *pe; |
230 | uint16_t hsize; | ||
228 | 231 | ||
229 | pe = nl->pending; | 232 | pe = nl->pending; |
230 | while (NULL != pe) | 233 | while (NULL != pe) |
@@ -239,8 +242,9 @@ do_notify (struct NotifyList *nl, | |||
239 | nl->pending = pe; | 242 | nl->pending = pe; |
240 | if (nl->transmit_ctx != NULL) | 243 | if (nl->transmit_ctx != NULL) |
241 | return; /* already trying to transmit */ | 244 | return; /* already trying to transmit */ |
245 | hsize = (he->hello == NULL) ? 0 : GNUNET_HELLO_size (he->hello); | ||
242 | nl->transmit_ctx = GNUNET_SERVER_notify_transmit_ready (nl->client, | 246 | nl->transmit_ctx = GNUNET_SERVER_notify_transmit_ready (nl->client, |
243 | sizeof (struct InfoMessage) + GNUNET_HELLO_size (he->hello), | 247 | sizeof (struct InfoMessage) + hsize, |
244 | GNUNET_TIME_UNIT_FOREVER_REL, | 248 | GNUNET_TIME_UNIT_FOREVER_REL, |
245 | &transmit_pending_notification, | 249 | &transmit_pending_notification, |
246 | nl); | 250 | nl); |