gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit d9a0342d77f4489e56678d9a8e6afc9e25d8163d
parent 53f4571b0417080dcf13e26e2f32686cc9326a5d
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Mon, 19 Sep 2022 14:35:32 +0200

-fix fs index_start_failed

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Diffstat:
Msrc/fs/fs_publish.c | 2+-
Msrc/fs/gnunet-service-fs.c | 10++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c @@ -699,7 +699,7 @@ check_index_start_failed (void *cls, size_t msize = ntohs (msg->size) - sizeof(*msg); const char *emsg = (const char *) &msg[1]; - if (emsg[msize - sizeof(struct GNUNET_MessageHeader) - 1] != '\0') + if (emsg[msize - 1] != '\0') { GNUNET_break (0); return GNUNET_SYSERR; diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c @@ -1041,8 +1041,14 @@ hash_for_index_val (void *cls, "Hash mismatch trying to index file `%s' which does not have hash `%s'\n"), isc->filename, GNUNET_h2s (&isc->file_id)); - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED); + + const char *emsg = "hash mismatch"; + const size_t msize = strlen(emsg) + 1; + + env = GNUNET_MQ_msg_extra (msg, + msize, + GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED); + memcpy((char*) &msg[1], emsg, msize); GNUNET_MQ_send (lc->mq, env); GNUNET_SERVICE_client_continue (lc->client);