summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/apply.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 4afc94fdbd..dbdfa9b646 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1863,6 +1863,11 @@ static struct fragment *parse_binary_hunk(char **buf_p,
return NULL;
}
+/*
+ * Returns:
+ * -1 in case of error,
+ * the length of the parsed binary patch otherwise
+ */
static int parse_binary(char *buffer, unsigned long size, struct patch *patch)
{
/*
@@ -2008,6 +2013,8 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch)
linenr++;
used = parse_binary(buffer + hd + llen,
size - hd - llen, patch);
+ if (used < 0)
+ return -1;
if (used)
patchsize = used + llen;
else