Backport bug fix. Fixes bug#1240.
authorWerner Koch <wk@gnupg.org>
Fri, 18 Jun 2010 08:08:21 +0000 (08:08 +0000)
committerWerner Koch <wk@gnupg.org>
Fri, 18 Jun 2010 08:08:21 +0000 (08:08 +0000)
g10/ChangeLog
g10/parse-packet.c

index 5419e08..6b421df 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-18  Werner Koch  <wk@g10code.com>
+
+       * parse-packet.c (skip_packet, parse_gpg_control): Take care of
+       premature EOFs.  Backport from trunk.
+
 2010-06-01  Werner Koch  <wk@g10code.com>
 
        * gpg.c (main): Add dummy option --debug-level and ignore
index 60ca8af..4b0fd1c 100644 (file)
@@ -622,7 +622,11 @@ skip_packet( IOBUF inp, int pkttype, unsigned long pktlen, int partial )
          else
            {
              for( ; pktlen; pktlen-- )
-               dump_hex_line(iobuf_get(inp), &i);
+                {
+                  dump_hex_line ((c=iobuf_get(inp)), &i);
+                  if (c==-1)
+                    break;
+                }
            }
          putc ('\n', listfp);
          return;
@@ -2441,7 +2445,11 @@ parse_gpg_control( IOBUF inp, int pkttype,
         }
         else {
             for( ; pktlen; pktlen-- )
-                dump_hex_line(iobuf_get(inp), &i);
+              {
+                dump_hex_line ((c=iobuf_get (inp)), &i);
+                if (c == -1)
+                  break;
+              }
         }
         putc ('\n', listfp);
     }