diff --git a/util/ChangeLog b/util/ChangeLog index a782ee9c5..04fe9b26b 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,12 @@ +2005-03-10 Werner Koch + + * secmem.c (secmem_realloc): Take control information into account + when checking whether a resize is needed. + +2005-03-08 Werner Koch + + * miscutil.c (asctimestamp) [W32]: Don't use %Z. + 2005-02-03 Werner Koch * w32reg.c (read_w32_registry_string): Fallback to HKLM also for a @@ -1468,7 +1477,8 @@ Fri Feb 13 15:14:13 1998 Werner Koch (wk@isil.d.shuttle.de) - Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/util/miscutil.c b/util/miscutil.c index 82fe6a935..4c2c0edfc 100644 --- a/util/miscutil.c +++ b/util/miscutil.c @@ -167,7 +167,13 @@ asctimestamp( u32 stamp ) * These locales from glibc don't put the " %Z": * fi_FI hr_HR ja_JP lt_LT lv_LV POSIX ru_RU ru_SU sv_FI sv_SE zh_CN */ - strftime( buffer, DIM(buffer)-1, "%c %Z", tp ); + strftime( buffer, DIM(buffer)-1, +#ifdef HAVE_W32_SYSTEM + "%c" +#else + "%c %Z" +#endif + , tp ); #endif buffer[DIM(buffer)-1] = 0; #else diff --git a/util/secmem.c b/util/secmem.c index 82df884e4..de3e9d4fb 100644 --- a/util/secmem.c +++ b/util/secmem.c @@ -349,7 +349,10 @@ secmem_malloc( size_t size ) print_warn(); } - /* blocks are always a multiple of 32 */ + /* Blocks are always a multiple of 32. Note that we allocate an + extra of the size of an entire MEMBLOCK. This is required + becuase we do not only need the SIZE info but also extra space + to chain up unused memory blocks. */ size += sizeof(MEMBLOCK); size = ((size + 31) / 32) * 32; @@ -398,8 +401,12 @@ secmem_realloc( void *p, size_t newsize ) mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c)); size = mb->size; - if( newsize < size ) - return p; /* it is easier not to shrink the memory */ + 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 ); if ( a ) { memcpy(a, p, size);