mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: compare the coredump build SHA without reading past the array
app_elf_sha256 has no terminator (IDF 4.4 fills all 17 bytes), so strcmp never matched the running build and %s printed whatever followed it. Copy it into a terminated buffer first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2ee7af51ab
commit
e1c76bc2af
2 changed files with 15 additions and 1 deletions
|
|
@ -86,7 +86,11 @@ void setup() {
|
|||
#endif
|
||||
// The backtrace only decodes against the firmware.elf of the build that
|
||||
// crashed, so say whether that is the one running now.
|
||||
const char *crashedSha = (const char *)summary.app_elf_sha256;
|
||||
// app_elf_sha256 isn't always terminated, so copy it before comparing or
|
||||
// printing it.
|
||||
char crashedSha[APP_ELF_SHA256_SZ];
|
||||
static_assert(sizeof(crashedSha) <= sizeof(summary.app_elf_sha256), "copy would read past app_elf_sha256");
|
||||
SETCHARPROP(crashedSha, (const char *)summary.app_elf_sha256, sizeof(crashedSha));
|
||||
char runningSha[APP_ELF_SHA256_SZ] = {0};
|
||||
getRunningElfSha(runningSha, sizeof(runningSha));
|
||||
if(strcmp(crashedSha, runningSha) == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue