summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/unix/main.c b/unix/main.c
index a463d2e10a..17423de4d1 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -351,12 +351,20 @@ STATIC void pre_process_options(int argc, char **argv) {
heap_size *= 1024;
} else if ((*end | 0x20) == 'm') {
heap_size *= 1024 * 1024;
+ } else {
+ // Compensate for ++ below
+ --end;
+ }
+ if (*++end != 0) {
+ goto invalid_arg;
}
if (word_adjust) {
heap_size = heap_size * BYTES_PER_WORD / 4;
}
#endif
} else {
+invalid_arg:
+ printf("Invalid option\n");
exit(usage(argv));
}
a++;