aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-02-13 21:53:41 +0000
committerng0 <ng0@n0.is>2019-02-13 21:53:41 +0000
commit7285ae216aeb5dad89055085f2d7710c4ed5934e (patch)
tree8fe342cb10cd6c0ef5115ba761a07591ddaf2e05 /src/cadet/gnunet-service-cadet.c
parent1104fccaef9483fb92303eb5ce854b971b1b8151 (diff)
parent94911c3e57d5f77ddf68032789244d0475955149 (diff)
downloadgnunet-7285ae216aeb5dad89055085f2d7710c4ed5934e.tar.gz
gnunet-7285ae216aeb5dad89055085f2d7710c4ed5934e.zip
Merge branch 'master' of gnunet.org:gnunet
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;