summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Ilari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-26 20:24:13 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-26 12:57:59 -0800
commit222083a1585c058fd2bbcb76db1ea824ee3df17f (patch)
tree5fd4ec397fb32b91c7ffbd28400b8528be704e0a
parentAdd xmallocz() (diff)
downloadtgif-222083a1585c058fd2bbcb76db1ea824ee3df17f.tar.xz
Fix integer overflow in patch_delta()
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--patch-delta.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/patch-delta.c b/patch-delta.c
index e02e13bd4e..d218faa02b 100644
--- a/patch-delta.c
+++ b/patch-delta.c
@@ -33,8 +33,7 @@ void *patch_delta(const void *src_buf, unsigned long src_size,
/* now the result size */
size = get_delta_hdr_size(&data, top);
- dst_buf = xmalloc(size + 1);
- dst_buf[size] = 0;
+ dst_buf = xmallocz(size);
out = dst_buf;
while (data < top) {