1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* memory.c (realloc): Revert m_guard fix and stick an #error in there to

inform people not to use it.
This commit is contained in:
David Shaw 2006-04-11 19:45:44 +00:00
parent 27bb89d687
commit 8df71cf868
2 changed files with 10 additions and 4 deletions

View file

@ -503,21 +503,22 @@ FNAMEX(realloc)( void *a, size_t n FNAMEPRT )
#ifdef M_GUARD
if( a ) {
#error "--enable-m-guard does not currently work"
unsigned char *p = a;
size_t len = m_size(a);
if( len >= n ) /* we don't shrink for now */
return a;
if( p[-1] == MAGIC_SEC_BYTE )
b = FNAMEXM(alloc_secure_clear)(n FNAMEARG);
b = FNAME(alloc_secure_clear)(n FNAMEARG);
else
b = FNAMEXM(alloc_clear)(n FNAMEARG);
b = FNAME(alloc_clear)(n FNAMEARG);
FNAME(check)(NULL FNAMEARG);
memcpy(b, a, len );
FNAMEX(free)(p FNAMEARG);
FNAME(free)(p FNAMEARG);
}
else
b = FNAMEXM(alloc)(n FNAMEARG);
b = FNAME(alloc)(n FNAMEARG);
#else
if( m_is_secure(a) ) {
if( !(b = secmexrealloc( a, n )) )