diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-30 00:09:41 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-30 00:09:41 -0700 |
commit | 5b42477b59886a85d4b49a60313f9b9d4a0d576f (patch) | |
tree | 55e42d432085f0afec9a5bc9f4251adcf1dcbfa5 /rerere.c | |
parent | a059240f06967f485e0a094e220bae73a746ed24 (diff) | |
parent | b1905aeac5aded421cd90f8d264e27bb39672b36 (diff) | |
download | git-5b42477b59886a85d4b49a60313f9b9d4a0d576f.tar.gz |
Merge branch 'jm/maint-misc-fix' into maint
* jm/maint-misc-fix:
read_gitfile_gently: use ssize_t to hold read result
remove tests of always-false condition
rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
Diffstat (limited to 'rerere.c')
-rw-r--r-- | rerere.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -47,8 +47,14 @@ static void read_rr(struct string_list *rr) name = xstrdup(buf); if (fgetc(in) != '\t') die("corrupt MERGE_RR"); - for (i = 0; i < sizeof(buf) && (buf[i] = fgetc(in)); i++) - ; /* do nothing */ + for (i = 0; i < sizeof(buf); i++) { + int c = fgetc(in); + if (c < 0) + die("corrupt MERGE_RR"); + buf[i] = c; + if (c == 0) + break; + } if (i == sizeof(buf)) die("filename too long"); string_list_insert(rr, buf)->util = name; |