From f4900413a60e9e9cd110af24d3f33a323fad51d6 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Mon, 18 Dec 2023 20:47:26 -0800 Subject: [PATCH 1/3] Fix CWE-686: This argument should be of type 'void *' but is of type 'unsigned int'. --- tools/elf2uf2/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/elf2uf2/main.cpp b/tools/elf2uf2/main.cpp index 6b3c525d5..54cbf7ade 100644 --- a/tools/elf2uf2/main.cpp +++ b/tools/elf2uf2/main.cpp @@ -129,7 +129,7 @@ int check_address_range(const address_ranges& valid_ranges, uint32_t addr, uint3 for(const auto& range : valid_ranges) { if (range.from <= addr && range.to >= addr + size) { if (range.type == address_range::type::NO_CONTENTS && !uninitialized) { - return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory at %p", addr); + return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory at %p", (void *)addr); } ar = range; if (verbose) { From 5b68d783902d79a517332b0bb7c513064e65048b Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Mon, 18 Dec 2023 20:58:53 -0800 Subject: [PATCH 2/3] Fix identation. --- tools/elf2uf2/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/elf2uf2/main.cpp b/tools/elf2uf2/main.cpp index 54cbf7ade..ca7a46ccd 100644 --- a/tools/elf2uf2/main.cpp +++ b/tools/elf2uf2/main.cpp @@ -129,7 +129,7 @@ int check_address_range(const address_ranges& valid_ranges, uint32_t addr, uint3 for(const auto& range : valid_ranges) { if (range.from <= addr && range.to >= addr + size) { if (range.type == address_range::type::NO_CONTENTS && !uninitialized) { - return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory at %p", (void *)addr); + return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory at %p", (void *)addr); } ar = range; if (verbose) { From 2cbd69b6a743cbc678790d91e2cac3366d502c23 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Tue, 19 Dec 2023 00:29:59 -0800 Subject: [PATCH 3/3] Switch %p to %08x. --- tools/elf2uf2/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/elf2uf2/main.cpp b/tools/elf2uf2/main.cpp index ca7a46ccd..5245fec36 100644 --- a/tools/elf2uf2/main.cpp +++ b/tools/elf2uf2/main.cpp @@ -129,7 +129,7 @@ int check_address_range(const address_ranges& valid_ranges, uint32_t addr, uint3 for(const auto& range : valid_ranges) { if (range.from <= addr && range.to >= addr + size) { if (range.type == address_range::type::NO_CONTENTS && !uninitialized) { - return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory at %p", (void *)addr); + return fail(ERROR_INCOMPATIBLE, "ELF contains memory contents for uninitialized memory at %08x", addr); } ar = range; if (verbose) {