1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01: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

@ -1,3 +1,8 @@
2006-04-11 David Shaw <dshaw@jabberwocky.com>
* memory.c (realloc): Revert m_guard fix and stick an #error in
there to inform people not to use it.
2006-04-11 Werner Koch <wk@g10code.com> 2006-04-11 Werner Koch <wk@g10code.com>
* iobuf.c (IOBUF_BUFFER_SIZE): New to repalce hardwired 8192. * iobuf.c (IOBUF_BUFFER_SIZE): New to repalce hardwired 8192.

View File

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