From e916d668f7b184c41ee3d912ccda8cc7ca4aa765 Mon Sep 17 00:00:00 2001 From: "Peter H. Froehlich" Date: Tue, 27 Sep 2016 16:58:29 -0400 Subject: [PATCH] Fix unsigned conversion bug. Since readi() returns -1 for errors, checking with < against an unsigned value is inadvisable. Checking with != works as intended however. --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 6be6af1bc4..4d7d97cc8f 100644 --- a/exec.c +++ b/exec.c @@ -28,7 +28,7 @@ exec(char *path, char **argv) pgdir = 0; // Check ELF header - if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) + if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) goto bad; if(elf.magic != ELF_MAGIC) goto bad;