Skip to content

Commit d803adf

Browse files
committed
Fix incorrect access of global var
1 parent f22abab commit d803adf

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/homekit_debug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef unsigned char byte;
1919
#define HOMEKIT_LOG_DEBUG 3
2020

2121
#ifndef HOMEKIT_LOG_LEVEL
22-
#define HOMEKIT_LOG_LEVEL HOMEKIT_LOG_DEBUG
22+
#define HOMEKIT_LOG_LEVEL HOMEKIT_NO_LOG
2323
#endif
2424

2525
#define HOMEKIT_PRINTF XPGM_PRINTF

src/storage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ bool homekit_storage_magic_valid() {
102102
}
103103

104104
bool homekit_storage_set_magic() {
105-
if (!spiflash_write(MAGIC_ADDR, (byte *)hap_magic, sizeof(hap_magic))) {
105+
char magic[sizeof(hap_magic)];
106+
memcpy(magic, hap_magic, sizeof(magic));
107+
108+
if (!spiflash_write(MAGIC_ADDR, (byte *)magic, sizeof(magic))) {
106109
ERROR("Failed to write HomeKit storage magic");
107110
return false;
108111
}

0 commit comments

Comments
 (0)