diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-09-19 14:35:32 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-09-19 14:35:32 +0200 |
commit | d9a0342d77f4489e56678d9a8e6afc9e25d8163d (patch) | |
tree | 0089e5932c403182625d5bd7b2ef15293939db95 | |
parent | 53f4571b0417080dcf13e26e2f32686cc9326a5d (diff) |
-fix fs index_start_failed
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/fs/fs_publish.c | 2 | ||||
-rw-r--r-- | src/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 index f891f37a1..5cdf8f6e8 100644 --- 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 index 05c7e2192..c22a5b5a9 100644 --- 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); |