Skip to content

unixlauncher.c: Fix bounds check in which #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions unixlauncher.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ static char *which(const char *const executable) {
dirs[dirs_length] = ':';

size_t dir_head = 0;
size_t i = 0;
do {
for (size_t i = 0; i <= dirs_length; i++) {
if (dirs[i] == ':') {
// Declare convenient path variables
char *const dir = dirs + dir_head;
Expand All @@ -59,7 +58,7 @@ static char *which(const char *const executable) {

dir_head = i + 1;
}
} while (dirs[i++]);
};

// Lookup has failed, free if necessary and return NULL
if (exe_path != NULL) {
Expand Down