From dbab5d7fefe4b5d4131154c351020734a374757b Mon Sep 17 00:00:00 2001 From: gjelsoe <36234524+gjelsoe@users.noreply.github.com> Date: Sat, 16 Nov 2024 17:20:59 +0100 Subject: [PATCH] Update NodeDB.cpp Trunk --- src/mesh/NodeDB.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index d0b106f221..5119937aba 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -410,26 +410,26 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) // Initialize admin_key_count to zero byte numAdminKeys = 0; -// Check if USERPREFS_ADMIN_KEY_0 is non-empty -if (sizeof(USERPREFS_ADMIN_KEY_0) > 0) { - memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_0, 32); - config.security.admin_key[numAdminKeys].size = 32; - numAdminKeys++; -} + // Check if USERPREFS_ADMIN_KEY_0 is non-empty + if (sizeof(USERPREFS_ADMIN_KEY_0) > 0) { + memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_0, 32); + config.security.admin_key[numAdminKeys].size = 32; + numAdminKeys++; + } -// Check if USERPREFS_ADMIN_KEY_1 is non-empty -if (sizeof(USERPREFS_ADMIN_KEY_1) > 0) { - memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_1, 32); - config.security.admin_key[numAdminKeys].size = 32; - numAdminKeys++; -} + // Check if USERPREFS_ADMIN_KEY_1 is non-empty + if (sizeof(USERPREFS_ADMIN_KEY_1) > 0) { + memcpy(config.security.admin_key[numAdminKeys].bytes, USERPREFS_ADMIN_KEY_1, 32); + config.security.admin_key[numAdminKeys].size = 32; + numAdminKeys++; + } -// Check if USERPREFS_ADMIN_KEY_2 is non-empty -if (sizeof(USERPREFS_ADMIN_KEY_2) > 0) { - memcpy(config.security.admin_key[config.security.admin_key_count].bytes, USERPREFS_ADMIN_KEY_2, 32); - config.security.admin_key[config.security.admin_key_count].size = 32; - numAdminKeys++; -} + // Check if USERPREFS_ADMIN_KEY_2 is non-empty + if (sizeof(USERPREFS_ADMIN_KEY_2) > 0) { + memcpy(config.security.admin_key[config.security.admin_key_count].bytes, USERPREFS_ADMIN_KEY_2, 32); + config.security.admin_key[config.security.admin_key_count].size = 32; + numAdminKeys++; + } config.security.admin_key_count = numAdminKeys; #endif if (shouldPreserveKey) {