From f23ac5198485e94ca8429a519e3e8de7346380c6 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 9 Jun 2016 17:27:10 +0200 Subject: [PATCH] Added a check to prevent pre-2.0 stage1s from being installed --- source/installer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/installer.c b/source/installer.c index 2038a79..ca1e161 100755 --- a/source/installer.c +++ b/source/installer.c @@ -72,7 +72,7 @@ static inline void installer(u32 a9lhBoot) path = "a9lh/otp.bin"; if(fileRead((void *)OTP_OFFSET, path) != 256) { - u8 zeroes[256] = {0}; + const u8 zeroes[256] = {0}; if(memcmp((void *)OTP_FROM_MEM, zeroes, 256) == 0) shutdown(1, "Error: otp.bin doesn't exist and can't be dumped"); @@ -149,6 +149,10 @@ static inline void installer(u32 a9lhBoot) if(!size || size > MAX_STAGE1_SIZE) shutdown(1, "Error: payload_stage1.bin doesn't exist or\nexceeds max size"); + const u8 zeroes[688] = {0}; + if(memcmp(zeroes, (void *)STAGE1_OFFSET, 688) == 0) + shutdown(1, "Error: the payload_stage1.bin you're attempting\nto install is not compatible"); + //Read stage2 memset32((void *)STAGE2_OFFSET, 0, MAX_STAGE2_SIZE); path = "a9lh/payload_stage2.bin";