From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH 2/2] unpack-objects: allocate NUL byte at the buffer end
Date: Sat, 1 Mar 2008 22:21:22 +0100 [thread overview]
Message-ID: <12044064831419-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)
In-Reply-To: <12044064822655-git-send-email-mkoegler@auto.tuwien.ac.at>
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
builtin-unpack-objects.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
index 9d2a854..1845abc 100644
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
@@ -86,7 +86,8 @@ static void use(int bytes)
static void *get_data(unsigned long size)
{
z_stream stream;
- void *buf = xmalloc(size);
+ char *buf = xmalloc(size + 1);
+ buf[size] = 0;
memset(&stream, 0, sizeof(stream));
--
1.5.4.2.g4b5fd.dirty
next prev parent reply other threads:[~2008-03-01 21:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-01 21:21 [PATCH 1/2] index-pack: allocate NUL byte at the buffer end Martin Koegler
2008-03-01 21:21 ` Martin Koegler [this message]
2008-03-02 1:06 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12044064831419-git-send-email-mkoegler@auto.tuwien.ac.at \
--to=mkoegler@auto.tuwien.ac.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).