<<< Date Index >>>     <<< Thread Index >>>

Re: seg fault



On Thursday, 18 August 2005 at 12:03, Ken Weingold wrote:
> On Thu, Aug 18, 2005, Nathan Dushman wrote:
> > That's almost helpful, but not quite.  Could you compile mutt with 
> > debugging 
> > enabled, and then run mutt again in gdb?  When it crashes, run "backtrace" 
> > and send that output to the mutt-dev list.
> 
> I think I've mentioned it, but this is with NetBSD 2.0.
> 
> Here's the backtrace:
> 
> #0  0x4816a860 in fseek () from /usr/lib/libc.so.12
> #1  0x4816a73c in rewind () from /usr/lib/libc.so.12
> #2  0x0809de5f in pgp_application_pgp_handler (m=0x80f7800, s=0xbfbfe590)
>     at pgp.c:384

FYI, I've committed the following fix:

Index: pgp.c
===================================================================
RCS file: /home/roessler/cvs/mutt/pgp.c,v
retrieving revision 3.51
diff -u -p -r3.51 pgp.c
--- pgp.c       11 Aug 2005 21:16:38 -0000      3.51
+++ pgp.c       22 Aug 2005 16:03:47 -0000
@@ -381,8 +381,13 @@ int pgp_application_pgp_handler (BODY *m
        }
        
         /* treat empty result as sign of failure */
-       rewind (pgpout);
-        if ((c = fgetc (pgpout)) == EOF)
+       if (pgpout)
+       {
+         rewind (pgpout);
+         c = fgetc (pgpout);
+         ungetc (c, pgpout);
+       }
+        if (!pgpout || c == EOF)
        {
           mutt_error _("Could not decrypt PGP message");
           pgp_void_passphrase ();
@@ -390,7 +395,6 @@ int pgp_application_pgp_handler (BODY *m
           
           goto out;
         }
-       ungetc (c, pgpout);
       }
       
       /*

I'm still officially away for another week though...