reverse a check to be safer - stagit-gopher - A git gopher frontend. (mirror) HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit c582e516fd9521466f553e16af7cf6185fdb0235 DIR parent 326c0b91ac136447c1cb3f6cc2dc2053f320a5ee HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Fri, 23 Jun 2017 12:29:58 +0200 reverse a check to be safer Diffstat: M stagit-gopher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- DIR diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -470,7 +470,7 @@ writeblobgph(FILE *fp, const git_blob *blob) continue; n++; fprintf(fp, nfmt, n, n, n); - for (j = prev; s[j] && j <= i; j++) { + for (j = prev; j <= i && s[j]; j++) { switch (s[j]) { case '\r': break; case '\t': fputs(" ", fp); break; @@ -483,7 +483,7 @@ writeblobgph(FILE *fp, const git_blob *blob) if ((len - prev) > 0) { n++; fprintf(fp, nfmt, n, n, n); - for (j = prev; s[j] && j < len - prev; j++) { + for (j = prev; j < len - prev && s[j]; j++) { switch (s[j]) { case '\r': break; case '\t': fputs(" ", fp); break;