From 68949809836220d76ecd00bf5ee7f3e57d4032bf Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 16 Sep 2014 09:13:32 +0200 Subject: [PATCH] lib/package_msg.c: fix a heap overflow (noticed by @Gottox). --- lib/package_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/package_msg.c b/lib/package_msg.c index f71dba06..f7d7ee28 100644 --- a/lib/package_msg.c +++ b/lib/package_msg.c @@ -59,7 +59,7 @@ xbps_cb_message(struct xbps_handle *xhp, xbps_dictionary_t pkgd, const char *key xbps_dbg_printf(xhp, "[%s] %s: fmemopen %s\n", __func__, pkgver, strerror(rv)); goto out; }; - buf = malloc(len); + buf = malloc(len+1); assert(buf); if (fread(buf, len, 1, f) != len) { if (ferror(f)) {