commit ae1fc6dc6a3ddae0c32d9351399cf82c66209a90
parent e9710a909c82935ba97bfb393a20be2f9fc58a7b
Author: ukai <ukai>
Date: Wed, 5 Feb 2003 16:23:27 +0000
[w3m-dev 03729] buf fix of reAnchorNewsheader()
* anchor.c (reAnchorAny): check l->bpos
(reAnchorNewsheader): check l->bpos
strlen(*q)
lineBuf[l->size]
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,13 @@
2003-02-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03729] buf fix of reAnchorNewsheader()
+ * anchor.c (reAnchorAny): check l->bpos
+ (reAnchorNewsheader): check l->bpos
+ strlen(*q)
+ lineBuf[l->size]
+
+2003-02-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03728] IPv6 hostname
* url.c (parseURL): rewrite IPv6 address parser
diff --git a/anchor.c b/anchor.c
@@ -339,7 +339,7 @@ reAnchorAny(Buffer *buf, char *re,
Anchor *(*anchorproc) (Buffer *, char *, char *, int, int))
{
Line *l;
- char *p, *p1, *p2;
+ char *p = NULL, *p1, *p2;
if (re == NULL || *re == '\0') {
return NULL;
@@ -350,6 +350,8 @@ reAnchorAny(Buffer *buf, char *re,
for (l = MarkAllPages ? buf->firstLine : buf->topLine; l != NULL &&
(MarkAllPages || l->linenumber < buf->topLine->linenumber + LASTLINE);
l = l->next) {
+ if (p && l->bpos)
+ continue;
p = l->lineBuf;
for (;;) {
if (regexMatch(p, &l->lineBuf[l->size] - p, p == l->lineBuf) == 1) {
@@ -403,11 +405,13 @@ reAnchorNewsheader(Buffer *buf)
}
for (l = buf->firstLine; l != NULL && l->real_linenumber == 0;
l = l->next) {
+ if (l->bpos)
+ continue;
p = l->lineBuf;
if (!IS_SPACE(*p)) {
search = FALSE;
for (q = header; *q; q++) {
- if (!strncasecmp(p, *q, sizeof(*q) - 1)) {
+ if (!strncasecmp(p, *q, strlen(*q))) {
search = TRUE;
p = strchr(p, ':') + 1;
break;
@@ -417,7 +421,7 @@ reAnchorNewsheader(Buffer *buf)
if (!search)
continue;
for (;;) {
- if (regexMatch(p, &l->lineBuf[l->len] - p, p == l->lineBuf)
+ if (regexMatch(p, &l->lineBuf[l->size] - p, p == l->lineBuf)
== 1) {
matchedPosition(&p1, &p2);
p = reAnchorPos(buf, l, p1, p2, _put_anchor_news);