summaryrefslogtreecommitdiff
path: root/frontends/atari/file.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 /frontends/atari/file.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 'frontends/atari/file.c')
-rw-r--r--frontends/atari/file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/frontends/atari/file.c b/frontends/atari/file.c
index 7bc11dabc..3816e476d 100644
--- a/frontends/atari/file.c
+++ b/frontends/atari/file.c
@@ -112,6 +112,7 @@ static nserror atari_basename(const char *path, char **str, size_t *size)
static nserror atari_nsurl_to_path(struct nsurl *url, char **path_out)
{
lwc_string *urlpath;
+ size_t path_len;
char *path;
bool match;
lwc_string *scheme;
@@ -140,6 +141,7 @@ static nserror atari_nsurl_to_path(struct nsurl *url, char **path_out)
res = url_unescape(lwc_string_data(urlpath),
lwc_string_length(urlpath),
+ &path_len,
&path);
lwc_string_unref(urlpath);
if (res != NSERROR_OK) {
@@ -153,7 +155,7 @@ static nserror atari_nsurl_to_path(struct nsurl *url, char **path_out)
* strlen is *not* copying too much data as we are
* moving the null too!
*/
- memmove(path, path + 1, strlen(path));
+ memmove(path, path + 1, path_len);
}
/* if the path does not have a drive letter we return the
* complete path.