From 1e04fb285c3c09c4ddb38a89368ca5e7c17c3e88 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 26 Jan 2024 09:25:45 -0800 Subject: [PATCH] memeater: fixes. The ULONG_MAX turns into -1 here, which isn't what was intended. I'll avoid the bikeshed of the least worst full fix and take half the range which is plenty for my purposes. Also fix the array indexing to not segfault. --- toys/other/memeater.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toys/other/memeater.c b/toys/other/memeater.c index f2523c0e..17a3a4c3 100644 --- a/toys/other/memeater.c +++ b/toys/other/memeater.c @@ -20,12 +20,12 @@ config MEMEATER void memeater_main(void) { - unsigned long size = atolx_range(*toys.optargs, 0, ULONG_MAX), i, + unsigned long size = atolx_range(*toys.optargs, 0, LONG_MAX), i, *p = xmalloc(size); // Lock and dirty the physical pages. if (!FLAG(M) && mlock(p, size)) perror_exit("mlock"); - for (i = 0; i