diff options
author | James Bursa <james@netsurf-browser.org> | 2004-04-12 20:43:29 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2004-04-12 20:43:29 +0000 |
commit | 9d4f0a373cae0967de7ee73dcfb6b2ee00ee481a (patch) | |
tree | 3b0ab03f8a95137fa343d727b62c9d7fac591c7e /utils | |
parent | 7d165500d35292a5e09ba0182464ebfc65f56fb7 (diff) | |
download | netsurf-9d4f0a373cae0967de7ee73dcfb6b2ee00ee481a.tar.gz netsurf-9d4f0a373cae0967de7ee73dcfb6b2ee00ee481a.tar.bz2 |
[project @ 2004-04-12 20:43:29 by bursa]
Fix bug in url_join().
svn path=/import/netsurf/; revision=763
Diffstat (limited to 'utils')
-rw-r--r-- | utils/url.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/url.c b/utils/url.c index c1d2c5a48..f5ed80036 100644 --- a/utils/url.c +++ b/utils/url.c @@ -329,7 +329,7 @@ char *url_join(const char *rel, const char *base) path = buf; step7: /* 7) */ - res = malloc(scheme_len + 1 + 2 + authority_len + path_len + 1 + + res = malloc(scheme_len + 1 + 2 + authority_len + path_len + 1 + 1 + query_len + 1 + fragment_len + 1); if (!res) { LOG(("malloc failed")); @@ -346,8 +346,12 @@ step7: /* 7) */ strncpy(res + i, authority, authority_len); i += authority_len; } - strncpy(res + i, path, path_len); - i += path_len; + if (path_len) { + strncpy(res + i, path, path_len); + i += path_len; + } else { + res[i++] = '/'; + } if (query) { res[i++] = '?'; strncpy(res + i, query, query_len); |