commit 85f2c2e0132ed34974446382474602b11d336f3a from: Omar Polo date: Thu Aug 18 15:32:39 2022 UTC fix overflow in blame callback spotted by noticing gotwebd crashing on some blame requests. Diff from stsp@ with a fix from tracey@, I'm committing it only because he is short on time. ok stsp@ commit - 4fcc9f7404ca2e0dd2ee085f09d6246587c6c503 commit + 85f2c2e0132ed34974446382474602b11d336f3a blob - 1c6b1412caff118a949c9987314837db9934aa5e blob + f9bcb1bca8436bc052e3bdeab3be53a13add0a61 --- got/got.c +++ got/got.c @@ -5366,7 +5366,7 @@ blame_cb(void *arg, int nlines, int lineno, goto done; } - while (bline->annotated) { + while (a->lineno_cur <= a->nlines && bline->annotated) { char *smallerthan, *at, *nl, *committer; size_t len; blob - da9f041cbfef9184c60aa257ec187e714ee04860 blob + 9d0bbf58f683adb056c946f2084ab2897e4509f3 --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -3959,7 +3959,7 @@ gw_blame_cb(void *arg, int nlines, int lineno, goto done; } - while (bline->annotated) { + while (a->lineno_cur <= a->nlines && bline->annotated) { char *smallerthan, *at, *nl, *committer; char *href_diff = NULL; size_t len; blob - 1c274b225d0e710d16528c4b9970348bb3bec74e blob + cd1c209f3e5b30ad411c4e68162e69fde44b7100 --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -1334,7 +1334,7 @@ got_gotweb_blame_cb(void *arg, int nlines, int lineno, goto done; } - while (bline->annotated) { + while (a->lineno_cur <= a->nlines && bline->annotated) { int out_buff_size = 100; char *smallerthan, *at, *nl, *committer; char out_buff[out_buff_size];