From 8f74d5a0d7d8972475c68fd76bf643105551c61a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 22 Oct 2017 23:31:13 +0100 Subject: [PATCH] syscall_exec16: fix crash with small binaries, reduce code footprint --- Kernel/syscall_exec16.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Kernel/syscall_exec16.c b/Kernel/syscall_exec16.c index 4f6b6541..2f244771 100644 --- a/Kernel/syscall_exec16.c +++ b/Kernel/syscall_exec16.c @@ -155,13 +155,6 @@ arg_t _execve(void) /* We are definitely going to succeed with the exec, * so we can start writing over the old program */ - uput(hdr, (uint8_t *)progload, 16); - udata.u_count = 512 - 16; - udata.u_base = (uint8_t *)(progload + 16); - udata.u_sysio = false; - readi(ino, 0); - if (udata.u_count != 512 - 16) - goto nogood4; /* At this point, we are committed to reading in and * executing the program. This call must not block. */ @@ -174,9 +167,9 @@ arg_t _execve(void) * space and move it directly. */ - progptr = progload + 512; - if (bin_size > 512) { - bin_size -= 512; + progptr = progload + 16; + if (bin_size > 16) { + bin_size -= 16; udata.u_base = (uint8_t *)progptr; /* We copied the first block already */ udata.u_count = bin_size; udata.u_sysio = false; -- 2.34.1