Fix integer overflow in patch_delta()
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>
Tue, 26 Jan 2010 18:24:13 +0000 (20:24 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Jan 2010 20:57:59 +0000 (12:57 -0800)
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
patch-delta.c
index e02e13bd4eb2a92626c2d6f9cbf264abb15de9c5..d218faa02bd12b0e6a0df298a6a0e5787e46d93f 100644 (file)
@@ -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) {