[BACK]Return to patch-ac CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / news / tin / patches

File: [cvs.NetBSD.org] / pkgsrc / news / tin / patches / Attic / patch-ac (download)

Revision 1.4, Wed Jul 22 10:53:51 2009 UTC (14 years, 9 months ago) by wiz
Branch: MAIN
CVS Tags: pkgsrc-2011Q3-base, pkgsrc-2011Q3, pkgsrc-2011Q2-base, pkgsrc-2011Q2, pkgsrc-2011Q1-base, pkgsrc-2011Q1, pkgsrc-2010Q4-base, pkgsrc-2010Q4, pkgsrc-2010Q3-base, pkgsrc-2010Q3, pkgsrc-2010Q2-base, pkgsrc-2010Q2, pkgsrc-2010Q1-base, pkgsrc-2010Q1, pkgsrc-2009Q4-base, pkgsrc-2009Q4, pkgsrc-2009Q3-base, pkgsrc-2009Q3
Changes since 1.3: +48 -22 lines

Fix a core dump when listing an mhbox thread.
From Urs Janen (upstream). Ride update.

$NetBSD: patch-ac,v 1.4 2009/07/22 10:53:51 wiz Exp $

--- src/refs.c.orig	2008-12-30 20:26:24.000000000 +0100
+++ src/refs.c	2009-07-22 12:51:11.000000000 +0200
@@ -56,7 +56,7 @@
 static struct t_msgid *add_msgid(int key, const char *msgid, struct t_msgid *newparent);
 static struct t_msgid *find_next(struct t_msgid *ptr);
 static struct t_msgid *parse_references(char *r);
-static t_bool valid_msgid(const char *msgid);
+static t_bool valid_msgid(char *msgid);
 static unsigned int hash_msgid(const char *key);
 static void add_to_parent(struct t_msgid *ptr);
 static void build_thread(struct t_msgid *ptr);
@@ -176,15 +176,16 @@
  * Checks if Message-ID has valid format
  * Returns TRUE if it does, FALSE if it does not
  *
- * TODO: combine with post.c:damaged_id()?
+ * TODO: combine with post.c:damaged_id()
  */
 static t_bool
 valid_msgid(
-	const char *msgid)
+	char *msgid)
 {
 	size_t mlen = 0;
 	t_bool at_present = 0;
 
+	str_trim(msgid);
 	if (!msgid || *msgid != '<')
 		return FALSE;
 
@@ -968,6 +969,7 @@
 	for_each_art(i) {
 		art = &arts[i];
 
+		art->refptr = add_msgid(MSGID_REF, art->msgid, NULL); /* preset art->refptr */
 		if (art->refs) {
 			strip_line(art->refs);
 
@@ -999,9 +1001,7 @@
 					art->refptr = add_msgid(MSGID_REF, art->msgid, add_msgid(REF_REF, art->refs, NULL));
 				FreeAndNull(art->refs);
 			}
-		} else
-			if (valid_msgid(art->msgid))
-				art->refptr = add_msgid(MSGID_REF, art->msgid, NULL);
+		}
 		FreeAndNull(art->msgid);	/* Now cached - discard this */
 	}