Jeremy Henty wrote:
corvid wrote:
Probably reads the 0.1 as 0 and does the same bad thing we usually get when we have 0 and don't have a URL argument sending us somewhere else...
So the bug is that Html_tag_open_meta() does not check that it has found a URL before doing the redirect? Does the attached patch look sensible? (The patch is a little messy, but all it does is wrap the redirect code in a "if (*content) { ... }".)
Bump. Is this patch OK? Regards, Jeremy Henty
# HG changeset patch # Parent f3e1b0b004c5748988a344d68b80807495ef55d2 html.cc: Html_tag_open_meta(): check that the URL exists before redirecting.
diff -r f3e1b0b004c5 -r 1fb8f2b486fa src/html.cc --- a/src/html.cc Sat Jan 08 17:56:56 2011 +0000 +++ b/src/html.cc Mon Mar 21 07:49:47 2011 +0000 @@ -2868,42 +2868,45 @@ } /* Skip to anything after "URL=" */ while (*content && *(content++) != '=') ; - /* 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); + if (*content) { + + /* 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); + } + + if (delay == 0) { + /* zero-delay redirection */ + html->stop_parser = true; + DilloUrl *new_url = a_Url_new(mr_url, URL_STR(html->base_url)); + if (a_Capi_dpi_verify_request(html->bw, new_url)) + a_UIcmd_redirection0((void*)html->bw, new_url); + a_Url_free(new_url); + } else { + /* Send a custom HTML message. + * TODO: This is a hairy hack, + * It'd be much better to build a widget. */ + Dstr *ds_msg = dStr_sized_new(256); + dStr_sprintf(ds_msg, meta_template, mr_url, delay_str); + { + int o_InFlags = html->InFlags; + int o_TagSoup = html->TagSoup; + html->InFlags = IN_BODY; + html->TagSoup = false; + Html_write_raw(html, ds_msg->str, ds_msg->len, 0); + html->TagSoup = o_TagSoup; + html->InFlags = o_InFlags; + } + dStr_free(ds_msg, 1); + } + dFree(mr_url); }
- if (delay == 0) { - /* zero-delay redirection */ - html->stop_parser = true; - DilloUrl *new_url = a_Url_new(mr_url, URL_STR(html->base_url)); - if (a_Capi_dpi_verify_request(html->bw, new_url)) - a_UIcmd_redirection0((void*)html->bw, new_url); - a_Url_free(new_url); - } else { - /* Send a custom HTML message. - * TODO: This is a hairy hack, - * It'd be much better to build a widget. */ - Dstr *ds_msg = dStr_sized_new(256); - dStr_sprintf(ds_msg, meta_template, mr_url, delay_str); - { - int o_InFlags = html->InFlags; - int o_TagSoup = html->TagSoup; - html->InFlags = IN_BODY; - html->TagSoup = false; - Html_write_raw(html, ds_msg->str, ds_msg->len, 0); - html->TagSoup = o_TagSoup; - html->InFlags = o_InFlags; - } - dStr_free(ds_msg, 1); - } - dFree(mr_url); - } else if (!dStrcasecmp(equiv, "content-type") && (content = a_Html_get_attr(html, tag, tagsize, "content"))) { _MSG("Html_tag_open_meta: content={%s}\n", content);
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev