Commit 92d77d0e87a5f2a8c9c9b2431ffd264cb664e17a

Anthony Green 2022-05-23T21:03:00

Don't dereference beyond the last array entry. (#667)

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/moxie/ffi.c b/src/moxie/ffi.c
index 1a65660..41e20fe 100644
--- a/src/moxie/ffi.c
+++ b/src/moxie/ffi.c
@@ -245,7 +245,7 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
 	 start looking at the those passed on the stack.  */
       if (ptr == (char *) &register_args[6])
 	ptr = stack_args;
-      else if (ptr == (char *) &register_args[7])
+      else if (ptr == (register_args + sizeof(register_args)))
 	ptr = stack_args + 4;
     }