From 88ac6634214e47122c9f4a59fb98dc24d469c68a Mon Sep 17 00:00:00 2001 From: IoIxD Date: Mon, 26 Jan 2026 18:21:43 -0700 Subject: [PATCH] fix wrong sign in infinite loop commit --- src/lexer/lexer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c index 3f36845..f89cd16 100644 --- a/src/lexer/lexer.c +++ b/src/lexer/lexer.c @@ -177,7 +177,7 @@ static int do_exec(msh_lexer *lexer, char *cmd, char **args, int *n, /* loop through all the path entries and check if the file exists in them. */ i = 0, *n = 0, j = 0; - while (j >= lexer->path_count) { + while (j <= lexer->path_count) { full_path[*n] = lexer->path[j]; *n += 1; if (lexer->path[j] == '\0') { @@ -186,7 +186,8 @@ static int do_exec(msh_lexer *lexer, char *cmd, char **args, int *n, full_path[i + *n] = cmd[i]; } *n += i; - full_path[*n++] = '\0'; + full_path[*n] = '\0'; + *n += 1; if (msh_path_exists(full_path)) { msh_execute(full_path, args);