GnuPG 1.0.7 & AIX 4.3.3

David Shaw dshaw@jabberwocky.com
Tue Jul 16 13:50:01 2002


--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Jul 16, 2002 at 09:32:54AM +0200, hj.beckers@kreis-steinfurt.de wrote:
> I'm trying the above combination. Gpg is compiled as mentioned in the 
> mail-archives with
> "--enable-static-rnd=egd '--with-egd-socket=~/.gnupg/entropy' 
> --dysable-dynload". Egd is running.
> When I run "gpg --gen-key" and answer all questions, it runs for a while 
> (2-4 minutes) and stops
> then with the following error:
> 
> "gpg: out of  memory while allocating 0 bytes"

This is a known bug in 1.0.7.  It's fixed in 1.2, but in the meantime,
apply this patch.

David

-- 
   David Shaw  |  dshaw@jabberwocky.com  |  WWW http://www.jabberwocky.com/
+---------------------------------------------------------------------------+
   "There are two major products that come out of Berkeley: LSD and UNIX.
      We don't believe this to be a coincidence." - Jeremy S. Anderson

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

Index: memory.c
===================================================================
RCS file: /cvs/gnupg/gnupg/util/Attic/memory.c,v
retrieving revision 1.18.2.7
retrieving revision 1.18.2.8
diff -u -r1.18.2.7 -r1.18.2.8
--- memory.c	22 Dec 2001 18:47:58 -0000	1.18.2.7
+++ memory.c	2 May 2002 07:48:39 -0000	1.18.2.8
@@ -415,6 +415,8 @@
     char *p;
 
   #ifdef M_GUARD
+    if(!n)
+      out_of_core(n,0); /* should never happen */
     if( !(p = malloc( n + EXTRA_ALIGN+5 )) )
 	out_of_core(n,0);
     store_len(p,n,0);
@@ -422,6 +424,10 @@
     p[4+EXTRA_ALIGN+n] = MAGIC_END_BYTE;
     return p+EXTRA_ALIGN+4;
   #else
+    /* mallocing zero bytes is undefined by ISO-C, so we better make
+       sure that it won't happen */
+    if (!n)
+      n = 1;
     if( !(p = malloc( n )) )
 	out_of_core(n,0);
     return p;

--HlL+5n6rz5pIUxbD--