gpg: Stop early on bogus old style comment packets.
authorWerner Koch <wk@gnupg.org>
Thu, 11 Sep 2014 14:40:45 +0000 (16:40 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 11 Sep 2014 14:40:45 +0000 (16:40 +0200)
* g10/parse-packet.c (parse_key): Take care of too short packets for
old style commet packets.
--

GnuPG-bug-id: 1714

g10/parse-packet.c

index cfae788..edaa84d 100644 (file)
@@ -1978,7 +1978,9 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
          for (; pktlen; pktlen--)
            {
              int c;
-             c = iobuf_get_noeof (inp);
+             c = iobuf_get (inp);
+              if (c == -1)
+                break; /* Ooops: shorter than indicated.  */
              if (c >= ' ' && c <= 'z')
                es_putc (c, listfp);
              else