From 6b659c8a65c34d194d6440489442c411bb3f4c26 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 13 Feb 2019 17:51:29 +0100 Subject: trying to fix #5532 --- src/cadet/gnunet-service-cadet.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/cadet/gnunet-service-cadet.c') diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index d64242943..e29330f99 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c @@ -885,6 +885,13 @@ path_info_iterator (void *cls, path_length = GCPP_get_length (path); path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; if (sizeof (*resp) + path_size > UINT16_MAX) + { + /* try just giving the relevant path */ + path_length = GNUNET_MIN ((UINT16_MAX - sizeof (*resp)) / sizeof (struct GNUNET_PeerIdentity), + off); + path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; + } + if (sizeof (*resp) + path_size > UINT16_MAX) { LOG (GNUNET_ERROR_TYPE_WARNING, "Path of %u entries is too long for info message\n", @@ -899,9 +906,10 @@ path_info_iterator (void *cls, /* Don't copy first peer. First peer is always the local one. Last * peer is always the destination (leave as 0, EOL). */ - for (unsigned int i = 0; i <= off; i++) + for (unsigned int i = 0; i < path_length; i++) id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, i)); + resp->off = htonl (off); GNUNET_MQ_send (mq, env); return GNUNET_YES; -- cgit v1.2.3