aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/gnunet-service-cadet.c')
-rw-r--r--src/cadet/gnunet-service-cadet.c10
1 files changed, 9 insertions, 1 deletions
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
@@ -886,6 +886,13 @@ path_info_iterator (void *cls,
886 path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; 886 path_size = sizeof (struct GNUNET_PeerIdentity) * path_length;
887 if (sizeof (*resp) + path_size > UINT16_MAX) 887 if (sizeof (*resp) + path_size > UINT16_MAX)
888 { 888 {
889 /* try just giving the relevant path */
890 path_length = GNUNET_MIN ((UINT16_MAX - sizeof (*resp)) / sizeof (struct GNUNET_PeerIdentity),
891 off);
892 path_size = sizeof (struct GNUNET_PeerIdentity) * path_length;
893 }
894 if (sizeof (*resp) + path_size > UINT16_MAX)
895 {
889 LOG (GNUNET_ERROR_TYPE_WARNING, 896 LOG (GNUNET_ERROR_TYPE_WARNING,
890 "Path of %u entries is too long for info message\n", 897 "Path of %u entries is too long for info message\n",
891 path_length); 898 path_length);
@@ -899,9 +906,10 @@ path_info_iterator (void *cls,
899 /* Don't copy first peer. First peer is always the local one. Last 906 /* Don't copy first peer. First peer is always the local one. Last
900 * peer is always the destination (leave as 0, EOL). 907 * peer is always the destination (leave as 0, EOL).
901 */ 908 */
902 for (unsigned int i = 0; i <= off; i++) 909 for (unsigned int i = 0; i < path_length; i++)
903 id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, 910 id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path,
904 i)); 911 i));
912 resp->off = htonl (off);
905 GNUNET_MQ_send (mq, 913 GNUNET_MQ_send (mq,
906 env); 914 env);
907 return GNUNET_YES; 915 return GNUNET_YES;