Skip to content

Commit a1b15cc

Browse files
committed
Merge branch 'cx/fetch-display-ubfix'
Undefined-behaviour fix in "git fetch". * cx/fetch-display-ubfix: fetch: fix wrong evaluation order in URL trailing-slash trimming
2 parents a31d4f1 + f87593a commit a1b15cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ static void display_state_init(struct display_state *display_state, struct ref *
721721
display_state->url = xstrdup("foreign");
722722

723723
display_state->url_len = strlen(display_state->url);
724-
for (i = display_state->url_len - 1; display_state->url[i] == '/' && 0 <= i; i--)
724+
for (i = display_state->url_len - 1; 0 <= i && display_state->url[i] == '/'; i--)
725725
;
726726
display_state->url_len = i + 1;
727727
if (4 < i && !strncmp(".git", display_state->url + i - 3, 4))

0 commit comments

Comments
 (0)