From: Jon Feldman Date: Sat, 18 Feb 2017 21:34:44 +0000 (-0500) Subject: Fix a logic mistake (Should fix #61) X-Git-Tag: v0.3.1~3 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=edd4f18aeaeea66484ab37f5a1321e81ac411441;p=corbenik%2Fcorbenik.git Fix a logic mistake (Should fix #61) --- diff --git a/boot/firm/firm.c b/boot/firm/firm.c index aa4db06..ce8831f 100644 --- a/boot/firm/firm.c +++ b/boot/firm/firm.c @@ -96,7 +96,6 @@ load_firm(const char *path, size_t *size_out) if (!memcmp(firm->magic, "FIRM", 4) && memcmp(firm->magic + 4, "DEC", 3)) { if (sig->console == console_n3ds) { if (dec_k9l(firm)) { - free(firm); free(mem); return NULL; } @@ -118,7 +117,6 @@ load_firm(const char *path, size_t *size_out) patch_entry(firm, sig->type); if (sig->type == type_native && patch_section_keys(firm, sig->k9l)) { - free(firm); free(mem); return NULL; } diff --git a/boot/firm/util.c b/boot/firm/util.c index d1b50f5..a0f6d71 100644 --- a/boot/firm/util.c +++ b/boot/firm/util.c @@ -155,11 +155,9 @@ extract_firm_from_ncch(ncch_h *ncch, uint8_t *titlekey, size_t size) return NULL; } - firm_h* dest = memalign(16, size); + memmove(ncch, firm, size); - memcpy(dest, firm, size); - - return dest; + return (firm_h*)ncch; } uint8_t* key_search(uint8_t* mem, uint32_t size, uint8_t* sha256, uint8_t byte) {