aboutsummaryrefslogtreecommitdiff
path: root/src/dht/dht_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-29 12:35:56 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-29 12:35:56 +0000
commitc4e793586b16cb0351e3e72bf6a6d58f48befc3a (patch)
treedf191eae357b5b09d79e3b17cfa69d4b337ef505 /src/dht/dht_api.c
parentf88fa25e5c577cd6260e19bac428fa1f2fe4edd2 (diff)
downloadgnunet-c4e793586b16cb0351e3e72bf6a6d58f48befc3a.tar.gz
gnunet-c4e793586b16cb0351e3e72bf6a6d58f48befc3a.zip
-initialized uninitialized 'key' field in GetHandle to fix assertion in gnunet-service-dht_clients.c:721 due to uninitialized key in IPC message
Diffstat (limited to 'src/dht/dht_api.c')
-rw-r--r--src/dht/dht_api.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index 7b83c14c3..e045a8b75 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -1003,7 +1003,7 @@ GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1003 handle->cfg = cfg; 1003 handle->cfg = cfg;
1004 handle->uid_gen = 1004 handle->uid_gen =
1005 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); 1005 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
1006 handle->active_requests = GNUNET_CONTAINER_multihashmap_create (ht_len, GNUNET_NO); 1006 handle->active_requests = GNUNET_CONTAINER_multihashmap_create (ht_len, GNUNET_YES);
1007 if (GNUNET_NO == try_connect (handle)) 1007 if (GNUNET_NO == try_connect (handle))
1008 { 1008 {
1009 GNUNET_DHT_disconnect (handle); 1009 GNUNET_DHT_disconnect (handle);
@@ -1280,12 +1280,15 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
1280 pending); 1280 pending);
1281 pending->in_pending_queue = GNUNET_YES; 1281 pending->in_pending_queue = GNUNET_YES;
1282 get_handle = GNUNET_new (struct GNUNET_DHT_GetHandle); 1282 get_handle = GNUNET_new (struct GNUNET_DHT_GetHandle);
1283 get_handle->key = *key;
1283 get_handle->dht_handle = handle; 1284 get_handle->dht_handle = handle;
1284 get_handle->iter = iter; 1285 get_handle->iter = iter;
1285 get_handle->iter_cls = iter_cls; 1286 get_handle->iter_cls = iter_cls;
1286 get_handle->message = pending; 1287 get_handle->message = pending;
1287 get_handle->unique_id = get_msg->unique_id; 1288 get_handle->unique_id = get_msg->unique_id;
1288 GNUNET_CONTAINER_multihashmap_put (handle->active_requests, key, get_handle, 1289 GNUNET_CONTAINER_multihashmap_put (handle->active_requests,
1290 &get_handle->key,
1291 get_handle,
1289 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1292 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1290 process_pending_messages (handle); 1293 process_pending_messages (handle);
1291 return get_handle; 1294 return get_handle;
@@ -1363,7 +1366,7 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle)
1363 /* remove 'GET' from active status */ 1366 /* remove 'GET' from active status */
1364 GNUNET_assert (GNUNET_YES == 1367 GNUNET_assert (GNUNET_YES ==
1365 GNUNET_CONTAINER_multihashmap_remove (handle->active_requests, 1368 GNUNET_CONTAINER_multihashmap_remove (handle->active_requests,
1366 &get_msg->key, 1369 &get_handle->key,
1367 get_handle)); 1370 get_handle));
1368 if (GNUNET_YES == get_handle->message->in_pending_queue) 1371 if (GNUNET_YES == get_handle->message->in_pending_queue)
1369 { 1372 {
@@ -1416,7 +1419,7 @@ GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
1416 h->dht_handle = handle; 1419 h->dht_handle = handle;
1417 if (NULL != key) 1420 if (NULL != key)
1418 { 1421 {
1419 h->key = GNUNET_new(struct GNUNET_HashCode); 1422 h->key = GNUNET_new (struct GNUNET_HashCode);
1420 *h->key = *key; 1423 *h->key = *key;
1421 } 1424 }
1422 1425
@@ -1471,12 +1474,13 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle)
1471 m->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP); 1474 m->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP);
1472 m->header.size = htons (sizeof (struct GNUNET_DHT_MonitorStartStopMessage)); 1475 m->header.size = htons (sizeof (struct GNUNET_DHT_MonitorStartStopMessage));
1473 m->type = htonl(handle->type); 1476 m->type = htonl(handle->type);
1474 m->get = htons(NULL != handle->get_cb); 1477 m->get = htons (NULL != handle->get_cb);
1475 m->get_resp = htons(NULL != handle->get_resp_cb); 1478 m->get_resp = htons(NULL != handle->get_resp_cb);
1476 m->put = htons(NULL != handle->put_cb); 1479 m->put = htons (NULL != handle->put_cb);
1477 if (NULL != handle->key) { 1480 if (NULL != handle->key)
1478 m->filter_key = htons(1); 1481 {
1479 memcpy (&m->key, handle->key, sizeof(struct GNUNET_HashCode)); 1482 m->filter_key = htons (1);
1483 m->key = *handle->key;
1480 } 1484 }
1481 GNUNET_CONTAINER_DLL_insert (handle->dht_handle->pending_head, 1485 GNUNET_CONTAINER_DLL_insert (handle->dht_handle->pending_head,
1482 handle->dht_handle->pending_tail, 1486 handle->dht_handle->pending_tail,