From 9cbdef2552dc31d4faf71f5dc961f27f3a99d559 Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Mon, 3 Aug 2015 15:39:05 +0000 Subject: - check for uint32 value overflow --- src/rps/rps_api.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/rps/rps_api.c') diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c index e06f73b9c..1993ca8b8 100644 --- a/src/rps/rps_api.c +++ b/src/rps/rps_api.c @@ -64,11 +64,6 @@ struct GNUNET_RPS_Request_Handle */ struct GNUNET_RPS_Handle *rps_handle; - /** - * The id of the request. - */ - uint32_t id; - /** * The callback to be called when we receive an answer. */ @@ -78,6 +73,11 @@ struct GNUNET_RPS_Request_Handle * The closure for the callback. */ void *ready_cb_cls; + + /** + * The id of the request. + */ + uint32_t id; }; @@ -237,7 +237,8 @@ GNUNET_RPS_request_peers (struct GNUNET_RPS_Handle *rps_handle, // assert func != NULL rh = GNUNET_new (struct GNUNET_RPS_Request_Handle); rh->rps_handle = rps_handle; - rh->id = req_handlers_size; // TODO ntoh + GNUNET_assert (req_handlers_size < UINT32_MAX); + rh->id = (uint32_t) req_handlers_size; rh->ready_cb = ready_cb; rh->ready_cb_cls = cls; -- cgit v1.2.3