cscvs to tla changeset 98
authorJonathan McDowell <noodles@earth.li>
Mon, 31 May 2004 23:47:57 +0000 (23:47 +0000)
committerJonathan McDowell <noodles@earth.li>
Mon, 31 May 2004 23:47:57 +0000 (23:47 +0000)
Author: noodles
Date: 2003/09/30 17:40:41
Fix stupid bug with read_openpgp_stream and an empty packet list.

parsekey.c

index ea56f835282905c905b8194db8884cfd83438c07..9cdb90cc514d4e825d430b951ba4ea8a8ba3657d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Copyright 2002 Project Purple
  *
- * $Id: parsekey.c,v 1.11 2003/09/30 16:58:04 noodles Exp $
+ * $Id: parsekey.c,v 1.12 2003/09/30 17:40:41 noodles Exp $
  */
 
 #include <assert.h>
@@ -180,8 +180,10 @@ int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
 
        assert(packets != NULL);
        curpacket = *packets;
-       while (curpacket->next != NULL) {
-               curpacket = curpacket->next;
+       if (curpacket != NULL) {
+               while (curpacket->next != NULL) {
+                       curpacket = curpacket->next;
+               }
        }
 
        while (!rc && !getchar_func(ctx, 1, &curchar)) {