commit 3f17dee4f66ddd410b6ab5a184e3a8c3608d3892 from: Stefan Sperling date: Sat Jul 27 09:08:47 2019 UTC prevent array access with negative index in got_worktree_resolve_path() commit - c577a9cecea0c94f30a1e650e6e332fb8b43b9f6 commit + 3f17dee4f66ddd410b6ab5a184e3a8c3608d3892 blob - 686a315559b212e3c9a0e54239e92de274a498b4 blob + c15d384d2c146fcd939be25190f8eb596b845ca2 --- lib/worktree.c +++ lib/worktree.c @@ -2362,7 +2362,7 @@ got_worktree_resolve_path(char **wt_path, struct got_w /* XXX status walk can't deal with trailing slash! */ len = strlen(path); - while (path[len - 1] == '/') { + while (len > 0 && path[len - 1] == '/') { path[len - 1] = '\0'; len--; }