From 8e521a62065eaf390ca8f631bb7d1296f22b3075 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 18 Oct 2013 15:02:58 +0000 Subject: [PATCH] -fix bad allocation and message size calculation --- src/psyc/psyc_api.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index 51902dd1a..18b5920b3 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c @@ -788,10 +788,9 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, { struct GNUNET_PSYC_Slave *slv = GNUNET_malloc (sizeof (*slv)); struct GNUNET_PSYC_Channel *ch = &slv->ch; - struct SlaveJoinRequest *req = GNUNET_malloc (sizeof (*req)); - + struct SlaveJoinRequest *req = GNUNET_malloc (sizeof (*req) + + relay_count * sizeof (*relays)); req->header.size = htons (sizeof (*req) - + sizeof (*channel_key) + sizeof (*slave_key) + relay_count * sizeof (*relays)); req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN); req->channel_key = *channel_key; -- 2.25.1