STABLE-BRANCH-1-2 gnupg/util (ChangeLog secmem.c)

cvs user wk cvs at cvs.gnupg.org
Thu Mar 10 10:41:38 CET 2005


    Date: Thursday, March 10, 2005 @ 10:54:27
  Author: wk
    Path: /cvs/gnupg/gnupg/util
     Tag: STABLE-BRANCH-1-2

Modified: ChangeLog secmem.c

(secmem_realloc): Take control information into account
when testing for a resize.


-----------+
 ChangeLog |    5 +++++
 secmem.c  |    4 ++++
 2 files changed, 9 insertions(+)


Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.100.2.29 gnupg/util/ChangeLog:1.100.2.30
--- gnupg/util/ChangeLog:1.100.2.29	Fri Dec  3 21:04:08 2004
+++ gnupg/util/ChangeLog	Thu Mar 10 10:54:27 2005
@@ -1,3 +1,8 @@
+2005-03-10  Werner Koch  <wk at g10code.com>
+
+	* secmem.c (secmem_realloc): Take control information into account
+	when testing for a resize.
+
 2004-12-03  David Shaw  <dshaw at jabberwocky.com>
 
 	* http.c (send_request): Include the port if non-80 in the Host:
Index: gnupg/util/secmem.c
diff -u gnupg/util/secmem.c:1.35.2.5 gnupg/util/secmem.c:1.35.2.6
--- gnupg/util/secmem.c:1.35.2.5	Tue Feb 24 17:04:37 2004
+++ gnupg/util/secmem.c	Thu Mar 10 10:54:27 2005
@@ -393,6 +393,10 @@
 
     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 );




More information about the Gnupg-commits mailing list