summaryrefslogtreecommitdiff
path: root/utils/url.c
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 /utils/url.c
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 'utils/url.c')
-rw-r--r--utils/url.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/url.c b/utils/url.c
index 3be983d78..9294e3d31 100644
--- a/utils/url.c
+++ b/utils/url.c
@@ -54,7 +54,8 @@ static inline char xdigit_to_hex(char c)
/* exported interface documented in utils/url.h */
-nserror url_unescape(const char *str, size_t length, char **result_out)
+nserror url_unescape(const char *str, size_t length,
+ size_t *length_out, char **result_out)
{
const char *str_end;
size_t new_len;
@@ -106,6 +107,9 @@ nserror url_unescape(const char *str, size_t length, char **result_out)
}
}
+ if (length_out != NULL) {
+ *length_out = new_len;
+ }
*result_out = result;
return NSERROR_OK;
}