diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-07-25 14:30:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-07-25 14:30:10 +0000 |
commit | 4f3705cbfef52322292ce8b60f1d5326825f8606 (patch) | |
tree | d46c3294cb791d674ab63829d3559c9a162404f1 /src/datastore/datastore_api.c | |
parent | a8871b8ff983bdb8adc224a9a88ba5d2960df859 (diff) | |
download | gnunet-4f3705cbfef52322292ce8b60f1d5326825f8606.tar.gz gnunet-4f3705cbfef52322292ce8b60f1d5326825f8606.zip |
more tests
Diffstat (limited to 'src/datastore/datastore_api.c')
-rw-r--r-- | src/datastore/datastore_api.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index f9a28800c..361f76e4a 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -204,16 +204,21 @@ with_status_response_handler (void *cls, | |||
204 | sm = (const struct StatusMessage*) msg; | 204 | sm = (const struct StatusMessage*) msg; |
205 | status = ntohl(sm->status); | 205 | status = ntohl(sm->status); |
206 | emsg = NULL; | 206 | emsg = NULL; |
207 | if (status == GNUNET_SYSERR) | 207 | if (ntohs(msg->size) > sizeof(struct StatusMessage)) |
208 | { | 208 | { |
209 | emsg = (const char*) &sm[1]; | 209 | emsg = (const char*) &sm[1]; |
210 | if ( (ntohs(msg->size) == sizeof(struct StatusMessage)) || | 210 | if (emsg[ntohs(msg->size) - sizeof(struct StatusMessage) - 1] != '\0') |
211 | (emsg[ntohs(msg->size) - sizeof(struct StatusMessage) - 1] != '\0') ) | ||
212 | { | 211 | { |
213 | GNUNET_break (0); | 212 | GNUNET_break (0); |
214 | emsg = _("Invalid error message received from datastore service"); | 213 | emsg = _("Invalid error message received from datastore service"); |
215 | } | 214 | } |
216 | } | 215 | } |
216 | if ( (status == GNUNET_SYSERR) && | ||
217 | (emsg == NULL) ) | ||
218 | { | ||
219 | GNUNET_break (0); | ||
220 | emsg = _("Invalid error message received from datastore service"); | ||
221 | } | ||
217 | h->response_proc = NULL; | 222 | h->response_proc = NULL; |
218 | #if DEBUG_DATASTORE | 223 | #if DEBUG_DATASTORE |
219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -408,7 +413,7 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
408 | rm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE); | 413 | rm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE); |
409 | rm->header.size = htons(sizeof (struct ReserveMessage)); | 414 | rm->header.size = htons(sizeof (struct ReserveMessage)); |
410 | rm->entries = htonl(entries); | 415 | rm->entries = htonl(entries); |
411 | rm->amount = htonl(amount); | 416 | rm->amount = GNUNET_htonll(amount); |
412 | transmit_for_status (h, cont, cont_cls, timeout); | 417 | transmit_for_status (h, cont, cont_cls, timeout); |
413 | } | 418 | } |
414 | 419 | ||