From 6b19d6dc3899e1ed5109a6c58f58f970293237a5 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Fri, 17 Nov 2023 01:22:31 +0100 Subject: Fix chat contacts issue with locally unique id Signed-off-by: TheJackiMonster --- src/gnunet_chat_util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gnunet_chat_util.c b/src/gnunet_chat_util.c index 0faa331..5ddc824 100644 --- a/src/gnunet_chat_util.c +++ b/src/gnunet_chat_util.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2021--2022 GNUnet e.V. + Copyright (C) 2021--2023 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -30,8 +30,14 @@ util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, { GNUNET_assert(shorthash); + const size_t id = GNUNET_MESSENGER_contact_get_id(member); + memset(shorthash, 0, sizeof(*shorthash)); - GNUNET_memcpy(shorthash, &member, sizeof(member)); + GNUNET_memcpy( + shorthash, + &id, + sizeof(id) < sizeof(*shorthash) ? sizeof(id) : sizeof(*shorthash) + ); } void -- cgit v1.2.3