libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit 6b19d6dc3899e1ed5109a6c58f58f970293237a5
parent a0d5a648861807561ad32bda3ada6b3c0e3ffe4e
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Fri, 17 Nov 2023 01:22:31 +0100

Fix chat contacts issue with locally unique id

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

Diffstat:
Msrc/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 @@ -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