1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

(secmem_realloc): Take control information into account

when testing for a resize.
This commit is contained in:
Werner Koch 2005-03-10 09:54:27 +00:00
parent 37f8183d05
commit b79b1b9399
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-03-10 Werner Koch <wk@g10code.com>
* secmem.c (secmem_realloc): Take control information into account
when testing for a resize.
2004-12-03 David Shaw <dshaw@jabberwocky.com>
* http.c (send_request): Include the port if non-80 in the Host:

View File

@ -393,6 +393,10 @@ secmem_realloc( void *p, size_t newsize )
mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c));
size = mb->size;
if (size < sizeof(MEMBLOCK))
log_bug ("secure memory corrupted at block %p\n", mb);
size -= ((size_t) &((MEMBLOCK*)0)->u.aligned.c);
if( newsize < size )
return p; /* it is easier not to shrink the memory */
a = secmem_malloc( newsize );