gnupg/util (ChangeLog miscutil.c secmem.c)
cvs user wk
cvs at cvs.gnupg.org
Thu Mar 10 10:39:18 CET 2005
Date: Thursday, March 10, 2005 @ 10:52:05
Author: wk
Path: /cvs/gnupg/gnupg/util
Modified: ChangeLog miscutil.c secmem.c
(secmem_realloc): Take control information into account
when checking whether a resize is needed.
------------+
ChangeLog | 12 +++++++++++-
miscutil.c | 8 +++++++-
secmem.c | 13 ++++++++++---
3 files changed, 28 insertions(+), 5 deletions(-)
Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.181 gnupg/util/ChangeLog:1.182
--- gnupg/util/ChangeLog:1.181 Fri Feb 4 11:18:46 2005
+++ gnupg/util/ChangeLog Thu Mar 10 10:52:05 2005
@@ -1,3 +1,12 @@
+2005-03-10 Werner Koch <wk at g10code.com>
+
+ * secmem.c (secmem_realloc): Take control information into account
+ when checking whether a resize is needed.
+
+2005-03-08 Werner Koch <wk at g10code.com>
+
+ * miscutil.c (asctimestamp) [W32]: Don't use %Z.
+
2005-02-03 Werner Koch <wk at g10code.com>
* w32reg.c (read_w32_registry_string): Fallback to HKLM also for a
@@ -1468,7 +1477,8 @@
- 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
Index: gnupg/util/miscutil.c
diff -u gnupg/util/miscutil.c:1.33 gnupg/util/miscutil.c:1.34
--- gnupg/util/miscutil.c:1.33 Sat Feb 21 23:12:29 2004
+++ gnupg/util/miscutil.c Thu Mar 10 10:52:05 2005
@@ -167,7 +167,13 @@
* 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
Index: gnupg/util/secmem.c
diff -u gnupg/util/secmem.c:1.42 gnupg/util/secmem.c:1.43
--- gnupg/util/secmem.c:1.42 Thu Dec 16 06:16:09 2004
+++ gnupg/util/secmem.c Thu Mar 10 10:52:05 2005
@@ -349,7 +349,10 @@
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 @@
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);
More information about the Gnupg-commits
mailing list