From: Julian Andres Klode Date: Sat, 16 Jun 2012 12:38:09 +0000 (+0200) Subject: Zero out the new memory allocated with realloc(). X-Git-Tag: 0.9.7~3 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/61a406f0fc9c7b1807acb2ff146db6acd18e879c Zero out the new memory allocated with realloc(). --- diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 131cefd6e..77b4502f5 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -461,6 +461,8 @@ bool DynamicMMap::Grow() { return false; Base = realloc(Base, newSize); + /* Set new memory to 0 */ + memset((char*)Base + WorkSpace, 0, newSize - WorkSpace); if (Base == NULL) return false; } diff --git a/debian/changelog b/debian/changelog index 2050cb05a..1cdfbe61d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ apt (0.9.7) UNRELEASED; urgency=low - Fix the Fallback option to work correctly, by not calling realloc() on a map mapped by mmap(), and by using malloc and friends instead of new[]. + - Zero out the new memory allocated with realloc(). -- Julian Andres Klode Sat, 16 Jun 2012 14:28:38 +0200