[PATCH 06/19] site: transport peers: fix incorrect stride when debug output enabled

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Jun 21 04:22:46 BST 2012

When there are multiple peer addresses, attempts to copy them from one
table of peers addresses to another with transport_peers_copy will go
wrong because the stride argument to transport_peers_debug is wrong -
we take sizeof() the pointer rather than of the array element.

This will typically cause a segfault if it happens, but the bug can
only be triggered if LOG_PEER_ADDRS debugging is enabled.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
 site.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/site.c b/site.c
index b54b34e..fcc36d8 100644
--- a/site.c
+++ b/site.c
@@ -1603,7 +1603,7 @@ static void transport_peers_copy(struct site *st, transport_peers *dst,
     memcpy(dst->peers, src->peers, sizeof(*dst->peers) * dst->npeers);
-			  src->npeers, &src->peers->addr, sizeof(src->peers));
+			  src->npeers, &src->peers->addr, sizeof(*src->peers));
 void transport_xmit(struct site *st, transport_peers *peers,

More information about the sgo-software-discuss mailing list