mirror of
https://github.com/git/git.git
synced 2024-10-28 21:07:52 +01:00
check_sha1_signature: check return value from read_istream
It's possible for read_istream to return an error, in which case we just end up in an infinite loop (aside from EOF, we do not even look at the result, but just feed it straight into our running hash). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
45d4bdae59
commit
f54fac5378
1 changed files with 4 additions and 0 deletions
|
@ -1266,6 +1266,10 @@ int check_sha1_signature(const unsigned char *sha1, void *map,
|
|||
char buf[1024 * 16];
|
||||
ssize_t readlen = read_istream(st, buf, sizeof(buf));
|
||||
|
||||
if (readlen < 0) {
|
||||
close_istream(st);
|
||||
return -1;
|
||||
}
|
||||
if (!readlen)
|
||||
break;
|
||||
git_SHA1_Update(&c, buf, readlen);
|
||||
|
|
Loading…
Reference in a new issue