From 86926b73a9e5e74f1a2b203431ce13e1bbdf16f4 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Mon, 10 Apr 2000 19:18:12 +0200
Subject: [PATCH] Fixed bug causing core dump when handling an unfinished quote
 tag.

Rev: src/modules/Parser/html.c:1.87
---
 src/modules/Parser/html.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/modules/Parser/html.c b/src/modules/Parser/html.c
index aff807bf89..35b5253648 100644
--- a/src/modules/Parser/html.c
+++ b/src/modules/Parser/html.c
@@ -1747,7 +1747,11 @@ static int scan_for_string (struct parser_html_storage *this,
       TYPE *p, *e;							\
       struct piece *dst;						\
       int cdst;								\
-      if (!scan_forward (feed, c, &feed, &c, &look_for, 1)) return 0;	\
+      if (!scan_forward (feed, c, &feed, &c, &look_for, 1)) {		\
+	*destp = feed;							\
+	*d_p = c;							\
+	return 0;							\
+      }									\
 									\
       p = (TYPE *) str->str + 1;					\
       e = (TYPE *) str->str + str->len;					\
@@ -1755,7 +1759,12 @@ static int scan_for_string (struct parser_html_storage *this,
       cdst = c + 1;							\
       for (; p < e; p++, cdst++) {					\
 	while (cdst == dst->s->len) {					\
-	  if (!(dst = dst->next)) return 0;				\
+	  if (dst->next) dst = dst->next;				\
+	  else {							\
+	    *destp = dst;						\
+	    *d_p = dst->s->len;						\
+	    return 0;							\
+	  }								\
 	  cdst = 0;							\
 	}								\
 	if ((p_wchar2) *p !=						\
-- 
GitLab