summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2016-07-24 13:59:30 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2016-07-24 14:03:16 +0100
commitfa2e3b778465cd496aedde8e187038835a765c4f (patch)
tree106aaf119a4b3925769adb49479274f3c886a148 /content
parentcf753f20cc2a8506c831a5cedd933e3e78417261 (diff)
downloadnetsurf-fa2e3b778465cd496aedde8e187038835a765c4f.tar.gz
netsurf-fa2e3b778465cd496aedde8e187038835a765c4f.tar.bz2
URL unescape: return the new length to the caller.
The avoids situations were we threw away the length, only for the caller to have to strlen the returned string. Note, there seems to be a case of the amiga front end writing beyond end of allocation. Added a TODO for now.
Diffstat (limited to 'content')
-rw-r--r--content/fetchers/data.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index 6b8be8dfc..65d99cf14 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -138,7 +138,7 @@ static bool fetch_data_process(struct fetch_data_context *c)
char *params;
char *comma;
char *unescaped;
- int unescaped_len;
+ size_t unescaped_len;
/* format of a data: URL is:
* data:[<mimetype>][;base64],<data>
@@ -193,14 +193,13 @@ static bool fetch_data_process(struct fetch_data_context *c)
/* URL unescape the data first, just incase some insane page
* decides to nest URL and base64 encoding. Like, say, Acid2.
*/
- res = url_unescape(comma + 1, 0, &unescaped);
+ res = url_unescape(comma + 1, 0, &unescaped_len, &unescaped);
if (res != NSERROR_OK) {
msg.type = FETCH_ERROR;
msg.data.error = "Unable to URL decode data: URL";
fetch_data_send_callback(&msg, c);
return false;
}
- unescaped_len = strlen(unescaped);
if (c->base64) {
base64_decode_alloc(unescaped, unescaped_len, &c->data, &c->datalen);