From 2c49070d07e19cbbb92d7c144d89a2b1edbd82c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Fri, 17 Jul 1998 16:02:50 +0200
Subject: [PATCH] Fixed the string in mapping bug in parse_html_lines() too.

Rev: src/modules/spider/spider.c:1.74
---
 src/modules/spider/spider.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/modules/spider/spider.c b/src/modules/spider/spider.c
index 60448f8416..6948fe4718 100644
--- a/src/modules/spider/spider.c
+++ b/src/modules/spider/spider.c
@@ -43,7 +43,7 @@
 #include "threads.h"
 #include "operators.h"
 
-RCSID("$Id: spider.c,v 1.73 1998/07/16 20:34:20 grubba Exp $");
+RCSID("$Id: spider.c,v 1.74 1998/07/17 14:02:50 grubba Exp $");
 
 #ifdef HAVE_PWD_H
 #include <pwd.h>
@@ -944,15 +944,36 @@ void do_html_parse_lines(struct pike_string *ss,
 	
       if (sval1.type==T_STRING)
       {
+	int quote = 0;
 	/* A simple string ... */
+	if (last < i-1)
+	{ 
+	  push_string(make_shared_binary_string(s+last, i-last-1)); 
+	  (*strings)++; 
+	}
+
 	*(sp++)=sval1;
 #ifdef DEBUG
 	sval1.type=99;
 #endif
 	(*strings)++;
-/* 	find_endtag(sval2.u.string ,s+j, len-j, &l); * bug /law 960805 */
 	free_svalue(&sval2);
-	j+=l;
+
+	/* Scan ahead to the end of the tag... */
+	for (; j<len; j++) {
+	  if (quote) {
+	    if (s[j] == quote) {
+	      quote = 0;
+	    }
+	  } else if (s[j] == '>') {
+	    break;
+	  } else if ((s[j] == '\'') || (s[j] == '\"')) {
+	    quote = s[j];
+	  }
+	}
+	if (j < len) {
+	  j++;
+	}
 	i=last=j;
 	continue;
       }
-- 
GitLab