From: Oskari Saarenmaa Date: Fri, 4 Oct 2013 13:49:05 +0000 (+0300) Subject: virfile: safezero: fix buffer allocation max size X-Git-Tag: CVE-2013-4401~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b63a1d0e95c7d2fa46906777908ae5a1ccc4af97;p=thirdparty%2Flibvirt.git virfile: safezero: fix buffer allocation max size My previous commit 7dc1d4ab was supposed to change safezero to allocate 1 megabyte at maximum, but had the logic reversed and will allocate 1 megabyte at minimum (and a lot more at maximum.) Signed-off-by: Oskari Saarenmaa --- diff --git a/src/util/virfile.c b/src/util/virfile.c index f66212721c..e10de5aae7 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1075,7 +1075,7 @@ safezero(int fd, off_t offset, off_t len) /* Split up the write in small chunks so as not to allocate lots of RAM */ remain = len; - bytes = MAX(1024 * 1024, len); + bytes = MIN(1024 * 1024, len); r = VIR_ALLOC_N(buf, bytes); if (r < 0) {