summaryrefslogtreecommitdiff
blob: 74552499501ffe4a7f94b74fa86abce408fff978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
The package app-crypt/mhash-0.9.9 as well as app-crypt/mhash-0.9.9-r1 are
affected by a bug which causes memory to be leaked during
mhash_restore_state_mem.

In this function/patch, ret->state is allocated towards the beginning and later
on replaced with a new allocated area without freeing the old.  The patch fixes
it.

Patch already submitted upstream, but depending on speed, this may be faster to
patch in a new patchset.

Gentoo-Bug: 255006
Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=255006
Patch-URL: http://bugs.gentoo.org/attachment.cgi?id=178560
Signed-off-by: Thomas Harning <harningt@gmail.com>

--- mhash-0.9.9/lib/mhash.c	2007-02-21 01:18:46.000000000 -0500
+++ mhash-0.9.9-new/lib/mhash.c	2009-01-15 01:57:53.000000000 -0500
@@ -719,6 +719,8 @@
 	mutils_memcpy( &ret->state_size, &mem[pos], sizeof(ret->state_size));
 	pos += sizeof( ret->state_size);

+	if (ret->state)
+		mutils_free(ret->state);
 	ret->state = mutils_malloc(ret->state_size);
 	if (ret->state==NULL)
 		goto freeall;