diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-24 14:29:00 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-25 22:08:40 +0200 |
commit | a39ce5d20d540b2a12a36ad5cf5f058999fcb4bf (patch) | |
tree | 53aa50dbe17ce3783d21cbbfe79e2d9536656098 /src | |
parent | 06f9083bdeb085b7b9de762fa029f6519e142dbe (diff) |
Ignore meta refresh content without URL
The content="0" attribute was wrongly parsed as the URL "0". The change
makes the parser ignore a redirect with a content value that doesn't
have ";" or "url=" after the delay number.
Fixes: https://github.com/dillo-browser/dillo/issues/204
Diffstat (limited to 'src')
-rw-r--r-- | src/html.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/html.cc b/src/html.cc index 471a1afa..a55fd2a8 100644 --- a/src/html.cc +++ b/src/html.cc @@ -3152,19 +3152,28 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize) sprintf(delay_str, "."); } /* Skip to anything after "URL=" or ";" if "URL=" is not found */ + int has_url = 1; if ((p = dStriAsciiStr(content, "url="))) content = p + strlen("url="); else if ((p = strstr(content, ";"))) content = p + strlen(";"); - /* Handle the case of a quoted URL */ - if (*content == '"' || *content == '\'') { - if ((p = strchr(content + 1, *content))) - mr_url = dStrndup(content + 1, p - content - 1); - else - mr_url = dStrdup(content + 1); + else + has_url = 0; + + if (has_url) { + /* Handle the case of a quoted URL */ + if (*content == '"' || *content == '\'') { + if ((p = strchr(content + 1, *content))) + mr_url = dStrndup(content + 1, p - content - 1); + else + mr_url = dStrdup(content + 1); + } else { + mr_url = dStrdup(content); + } } else { - mr_url = dStrdup(content); + mr_url = dStrdup(""); } + new_url = a_Html_url_new(html, mr_url, NULL, 0); if (a_Url_cmp(html->base_url, new_url) == 0) { |