commit 0b531f2204d5a3504b0dfaf8f96a486a229a917b
parent 02c547574b1fed9495195ccd5cb45584f2dd731b
Author: ukai <ukai>
Date: Fri, 20 Dec 2002 20:20:52 +0000
[w3m-dev 03590] segmentation fault when <title> exist after <img>
* file.c (save_line): deleted
(save_prevchar): deleted
(save_obuf): added
(HTMLtagproc1): bcopy save_obuf
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,11 @@
+2002-12-21 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03590] segmentation fault when <title> exist after <img>
+ * file.c (save_line): deleted
+ (save_prevchar): deleted
+ (save_obuf): added
+ (HTMLtagproc1): bcopy save_obuf
+
2002-12-20 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03588] include time.h in ftp.c
diff --git a/file.c b/file.c
@@ -95,8 +95,7 @@ static char check_charset(char *s);
static char check_accept_charset(char *s);
#endif
-static Str save_line = NULL;
-static int save_prevchar = ' ';
+static struct readbuffer save_obuf;
struct link_stack {
int cmd;
@@ -4301,9 +4300,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
return 1;
case HTML_TITLE:
append_tags(obuf);
- save_line = obuf->line;
- save_prevchar = obuf->prevchar;
set_breakpoint(obuf, 0);
+ bcopy((void *)obuf, (void *)&save_obuf, sizeof(struct readbuffer));
obuf->line = Strnew();
discardline(obuf, 0);
obuf->flag |= (RB_NOBR | RB_TITLE);
@@ -4312,12 +4310,11 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (!(obuf->flag & RB_TITLE))
return 1;
obuf->flag &= ~(RB_NOBR | RB_TITLE);
- append_tags(obuf);
tmp = Strnew_charp(obuf->line->ptr);
Strremovetrailingspaces(tmp);
h_env->title = html_unquote(tmp->ptr);
- obuf->line = save_line;
- obuf->prevchar = save_prevchar;
+ bcopy((void *)&save_obuf, (void *)obuf, sizeof(struct readbuffer));
+ append_tags(obuf);
back_to_breakpoint(obuf);
tmp = Strnew_m_charp("<title_alt title=\"",
html_quote(h_env->title), "\">", NULL);