From 8612c1287a1c458a17f33af1d679d30a13dea772 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 26 Apr 2018 17:24:51 -0700 Subject: altoslib: Fix data fetching during flashing of cc1111-based devices We want to get enough information about the target device to verify that the new firmware matches, so fetch 512 bytes instead of just barely enough to cover the romconfig data. Also catch out-of-bounds accesses and handle them, in case even this large array isn't enough. Signed-off-by: Keith Packard --- altoslib/AltosRomconfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'altoslib/AltosRomconfig.java') diff --git a/altoslib/AltosRomconfig.java b/altoslib/AltosRomconfig.java index 1fbb4115..44a3fa60 100644 --- a/altoslib/AltosRomconfig.java +++ b/altoslib/AltosRomconfig.java @@ -35,12 +35,12 @@ public class AltosRomconfig { System.out.printf("no symbol %s\n", name); throw new AltosNoSymbol(name); } - if (hexfile.address <= symbol.address && symbol.address + len < hexfile.max_address) { + if (hexfile.address <= symbol.address && symbol.address + len <= hexfile.max_address) { System.out.printf("%s: %x\n", name, symbol.address); return symbol.address; } - System.out.printf("invalid symbol addr %x range is %x - %x\n", - symbol.address, hexfile.address, hexfile.max_address); + System.out.printf("invalid symbol addr %x len %d range is %x - %x\n", + symbol.address, len, hexfile.address, hexfile.max_address); throw new AltosNoSymbol(name); } -- cgit v1.2.3