[svn] GpgOL - r235 - trunk/src

svn author wk cvs at cvs.gnupg.org
Tue Mar 18 12:04:45 CET 2008


Author: wk
Date: 2008-03-18 12:04:43 +0100 (Tue, 18 Mar 2008)
New Revision: 235

Modified:
   trunk/src/ChangeLog
   trunk/src/engine-assuan.c
   trunk/src/mimeparser.c
   trunk/src/rfc822parse.c
Log:
Fixed a segv in the mime parser.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-03-11 11:00:21 UTC (rev 234)
+++ trunk/src/ChangeLog	2008-03-18 11:04:43 UTC (rev 235)
@@ -1,3 +1,16 @@
+2008-03-18  Werner Koch  <wk at g10code.com>
+
+	* mimeparser.c (message_cb): Clear all mimestruct fields.  Fixes
+	segv introduced 2008-03-07.
+
+	* engine-assuan.c (async_worker_thread): Handle broken pipe.
+
+2008-03-13  Werner Koch  <wk at g10code.com>
+
+	* mimeparser.c (message_cb): Skip the OPEN event in non-MIME mode.
+
+	* rfc822parse.c (rfc822parse_open): Reset ERRNO.
+
 2008-03-11  Werner Koch  <wk at g10code.com>
 
 	* engine-assuan.c (op_assuan_encrypt): Factor some code out to ..

Modified: trunk/src/engine-assuan.c
===================================================================
--- trunk/src/engine-assuan.c	2008-03-11 11:00:21 UTC (rev 234)
+++ trunk/src/engine-assuan.c	2008-03-18 11:04:43 UTC (rev 235)
@@ -839,7 +839,8 @@
   for (;;)
     {
       /* Process our queue and fire up async I/O requests.  */
-/*       log_debug ("%s:%s: processing work queue", SRCNAME, __func__); */
+      if (debug_ioworker_extra)
+        log_debug ("%s:%s: processing work queue", SRCNAME, __func__);
       EnterCriticalSection (&work_queue_lock);
       hdarraylen = 0;
       hdarray[hdarraylen++] = work_queue_event;
@@ -930,10 +931,16 @@
             }
           else if (n >= 0 && n < hdarraylen)
             {
-/*               log_debug ("%s:%s: WFMO succeeded (res=%d)",SRCNAME,__func__, n); */
+              if (debug_ioworker_extra)
+                log_debug ("%s:%s: WFMO succeeded (res=%d)",
+                           SRCNAME,__func__, n);
             }
           else if (n == hdarraylen)
-            ; /* Message event.  */
+            {
+              if (debug_ioworker_extra)
+                log_debug ("%s:%s: WFMO succeeded - MSGEVENT (res=%d)",
+                           SRCNAME,__func__, n);
+            }
           else
             {
               log_error ("%s:%s: WFMO returned: %d", SRCNAME, __func__, n);
@@ -984,6 +991,15 @@
                   item->io_pending = 0;
                   item->got_ready = 1;
                 }
+              else if (!item->writing && syserr == ERROR_BROKEN_PIPE)
+                {
+                  /* Got EOF.  */
+                  if (debug_ioworker)
+                    log_debug ("%s:%s: [%s:%p] EOF (broken pipe) received",
+                               SRCNAME, __func__, item->name, item->hd);
+                  item->io_pending = 0;
+                  item->got_ready = 1;
+                }
               else
                 {
                   log_error_w32 (syserr,

Modified: trunk/src/mimeparser.c
===================================================================
--- trunk/src/mimeparser.c	2008-03-11 11:00:21 UTC (rev 234)
+++ trunk/src/mimeparser.c	2008-03-18 11:04:43 UTC (rev 235)
@@ -70,7 +70,7 @@
   mimestruct_item_t next;
   unsigned int level;   /* Level in the hierarchy of that part.  0
                            indicates the outer body.  */
-  char *filename;       /* Malloced fileanme or NULL.  */
+  char *filename;       /* Malloced filename or NULL.  */
   char *charset;        /* Malloced charset or NULL.  */
   char content_type[1]; /* String with the content type. */
 };
@@ -253,7 +253,7 @@
       symenc_close (ctx->symenc);
       ctx->symenc = NULL;
     }
-  
+
   /* Before we start with the first attachment we need to delete all
      attachments which might have been created already by a past
      parser run.  */
@@ -923,6 +923,8 @@
   if (ctx->no_mail_header)
     {
       /* Assume that this is not a regular mail but plain text. */
+      if (event == RFC822PARSE_OPEN)
+        return 0; /*  We need to skip the OPEN event.  */
       if (!ctx->body_seen)
         {
 #ifdef DEBUG_PARSER
@@ -946,6 +948,8 @@
             ms->next = NULL;
             strcpy (stpcpy (stpcpy (ms->content_type, ctmain), "/"), ctsub);
             ms->level = 0;
+            ms->filename = NULL;
+            ms->charset = NULL;
           }
           if (start_attachment (ctx, 1))
             return -1;

Modified: trunk/src/rfc822parse.c
===================================================================
--- trunk/src/rfc822parse.c	2008-03-11 11:00:21 UTC (rev 234)
+++ trunk/src/rfc822parse.c	2008-03-18 11:04:43 UTC (rev 235)
@@ -250,6 +250,7 @@
             {
               release_handle_data (msg);
               free (msg);
+              errno = 0;/* Not meaningful after the callback.  */ 
               msg = NULL;
             }
         }




More information about the Gnupg-commits mailing list