From: Christian Grothoff Date: Mon, 19 Dec 2011 21:00:48 +0000 (+0000) Subject: -not all uris are ksks X-Git-Tag: initial-import-from-subversion-38251~15567 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ee1e3f6aa111940f28c4f75f5a4b0a3a0d2c4527;p=oweals%2Fgnunet.git -not all uris are ksks --- diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 075bedc21..293638732 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -1793,10 +1793,15 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr) || (GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->mandatory_missing)) || (GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->optional_support)) || (GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->availability_success)) || - (GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->availability_trials)) || - (GNUNET_OK != GNUNET_BIO_write (wh, sr->keyword_bitmap, - (sr->uri == NULL) ? 0 : (sr->uri->data.ksk.keywordCount + 7) / 8)) ) - + (GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->availability_trials)) ) + { + GNUNET_break (0); + goto cleanup; + } + if ( (sr->uri != NULL) && + (sr->uri->type == ksk) && + (GNUNET_OK != GNUNET_BIO_write (wh, sr->keyword_bitmap, + (sr->uri->data.ksk.keywordCount + 7) / 8)) ) { GNUNET_break (0); goto cleanup; @@ -2098,13 +2103,17 @@ deserialize_search_result (void *cls, const char *filename) GNUNET_break (0); goto cleanup; } - sr->keyword_bitmap = GNUNET_malloc ((sr->uri->data.ksk.keywordCount + 7) / 8); /* round up, count bits */ - if (GNUNET_OK != GNUNET_BIO_read (rh, "keyword-bitmap", - sr->keyword_bitmap, - (sr->uri == NULL) ? 0 : (sr->uri->data.ksk.keywordCount + 7) / 8)) + if ( (NULL != sr->uri) && + (sr->uri->type == ksk) ) { - GNUNET_break (0); - goto cleanup; + sr->keyword_bitmap = GNUNET_malloc ((sr->uri->data.ksk.keywordCount + 7) / 8); /* round up, count bits */ + if (GNUNET_OK != GNUNET_BIO_read (rh, "keyword-bitmap", + sr->keyword_bitmap, + (sr->uri->data.ksk.keywordCount + 7) / 8)) + { + GNUNET_break (0); + goto cleanup; + } } GNUNET_free (uris); if (download != NULL)