[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 12/19: fix a few off-by-ones
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 12/19: fix a few off-by-ones |
Date: |
Sun, 22 Jan 2017 15:23:53 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 56d30aad489be8384701d7f2db320c3f75b157e2
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 22 14:19:12 2017 +0100
fix a few off-by-ones
---
src/cadet/gnunet-service-cadet-new_connection.c | 14 ++++++--------
src/cadet/gnunet-service-cadet-new_paths.c | 2 +-
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c
b/src/cadet/gnunet-service-cadet-new_connection.c
index e22202a59..65f45628d 100644
--- a/src/cadet/gnunet-service-cadet-new_connection.c
+++ b/src/cadet/gnunet-service-cadet-new_connection.c
@@ -294,16 +294,16 @@ send_create (void *cls)
cc->task = NULL;
GNUNET_assert (GNUNET_YES == cc->mqm_ready);
- path_length = GCPP_get_length (cc->path) + 1;
+ path_length = GCPP_get_length (cc->path);
env = GNUNET_MQ_msg_extra (create_msg,
- path_length * sizeof (struct GNUNET_PeerIdentity),
+ (1 + path_length) * sizeof (struct
GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE);
create_msg->cid = cc->cid;
pids = (struct GNUNET_PeerIdentity *) &create_msg[1];
pids[0] = my_full_id;
- for (unsigned int i=1;i<=path_length;i++)
- pids[i] = *GCP_get_id (GCPP_get_peer_at_offset (cc->path,
- i - 1));
+ for (unsigned int i=0;i<path_length;i++)
+ pids[i + 1] = *GCP_get_id (GCPP_get_peer_at_offset (cc->path,
+ i));
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending CONNECTION_CREATE message for connection %s\n",
GCC_2s (cc));
@@ -685,15 +685,13 @@ GCC_debug (struct CadetConnection *cc,
"Connection (NULL)\n");
return;
}
- s = GCPP_2s (cc->path);
LOG2 (level,
"Connection %s to %s via path %s in state %d is %s\n",
GCC_2s (cc),
GCP_2s (cc->destination),
- s,
+ GCPP_2s (cc->path),
cc->state,
(GNUNET_YES == cc->mqm_ready) ? "ready" : "busy");
- GNUNET_free (s);
}
/* end of gnunet-service-cadet-new_connection.c */
diff --git a/src/cadet/gnunet-service-cadet-new_paths.c
b/src/cadet/gnunet-service-cadet-new_paths.c
index bbe9af8b4..926e983c0 100644
--- a/src/cadet/gnunet-service-cadet-new_paths.c
+++ b/src/cadet/gnunet-service-cadet-new_paths.c
@@ -478,7 +478,7 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity
*get_path,
return;
}
path->hn = hn;
- path->entries_length = i;
+ path->entries_length = i + 1;
path->entries = GNUNET_new_array (path->entries_length,
struct CadetPeerPathEntry);
for (;i>=0;i--)
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] branch master updated (a225f5848 -> 4c56d5a0f), gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 05/19: only send CHANNEL_DESTROY message if we at least send the CHANNEL_CREATE message, and not if the tunnel never went up in the first place, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 08/19: allow NULL argument for GNUNET_i2s(), gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 03/19: improve logging, log before doing, not after, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 01/19: optimize startup sequence for when we execute first DHT PUTs, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 11/19: fix buffer size, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 04/19: fix startup interaction between channel and tunnel to not send CHANNEL_OPEN until tunnel is in KEY_OK state, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 18/19: nicer logging, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 10/19: make GCPP_2s also return static string, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 12/19: fix a few off-by-ones,
gnunet <=
- [GNUnet-SVN] [gnunet] 02/19: do not run upnpc during tests, produces unnecessary errors if not available, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 16/19: nicer order of LOG statements, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 13/19: properly launch DHT GETs based on need for paths, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 17/19: must delay iteration over paths until later, as we may be right now creating a connection, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 19/19: must not move location of -struct CadetPeerPathEntry- in memory when growing path length as those structs are also referenced from a DLL, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 07/19: introcude GNUNET_i2s2(), gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 14/19: fix indentation, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 15/19: minor cleanup, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 09/19: more logging for cadet-core subsystem, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 06/19: improving logging, gnunet, 2017/01/22