From 5e301937f233f33dca2f59a6e83ce40702bf0de4 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 19 Jan 2025 15:22:46 -0500 Subject: [PATCH] use pointer to whole struct instead publicKey for buffer --- libi2pd/Identity.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libi2pd/Identity.cpp b/libi2pd/Identity.cpp index 89bf71d4..b58d18b6 100644 --- a/libi2pd/Identity.cpp +++ b/libi2pd/Identity.cpp @@ -27,18 +27,15 @@ namespace data size_t Identity::FromBuffer (const uint8_t * buf, size_t len) { - if ( len < DEFAULT_IDENTITY_SIZE ) { - // buffer too small, don't overflow - return 0; - } - memcpy (publicKey, buf, DEFAULT_IDENTITY_SIZE); + if (len < DEFAULT_IDENTITY_SIZE) return 0; // buffer too small, don't overflow + memcpy (this, buf, DEFAULT_IDENTITY_SIZE); return DEFAULT_IDENTITY_SIZE; } IdentHash Identity::Hash () const { IdentHash hash; - SHA256(publicKey, DEFAULT_IDENTITY_SIZE, hash); + SHA256((const uint8_t *)this, DEFAULT_IDENTITY_SIZE, hash); return hash; }