diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-10-05 09:46:06 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-10-05 09:46:06 +0000 |
commit | 0c30fe98af6c88124cbe234131fae86671f19092 (patch) | |
tree | 849865626775758b7dc6d359d0c04b800cc5ffa1 /utils/nsurl.c | |
parent | 20c70fcb90ac0586a1ab298f732f04b3d8d84dda (diff) | |
download | netsurf-0c30fe98af6c88124cbe234131fae86671f19092.tar.gz netsurf-0c30fe98af6c88124cbe234131fae86671f19092.tar.bz2 |
Handle % in URL without 2 hex digits after.
svn path=/trunk/netsurf/; revision=12953
Diffstat (limited to 'utils/nsurl.c')
-rw-r--r-- | utils/nsurl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/nsurl.c b/utils/nsurl.c index f21f02675..3eb06fc94 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -586,9 +586,9 @@ static inline int nsurl__get_ascii_offset(char c1, char c2) /* Use 2nd char as least significant hex digit and sum */ if (isdigit(c2)) offset += c2 - '0'; - else if (c2 >= 'a' && c2 <= 'f')) + else if (c2 >= 'a' && c2 <= 'f') offset += c2 - 'a' + 10; - else if (c2 >= 'A' && c2 <= 'F')) + else if (c2 >= 'A' && c2 <= 'F') offset += c2 - 'A' + 10; else /* Not valid hex */ @@ -681,6 +681,12 @@ static nserror nsurl__create_from_section(const char const *url_s, ascii_offset = nsurl__get_ascii_offset(*(pos + 1), *(pos + 2)); + if (ascii_offset < 0) { + /* % with invalid hex digits. */ + copy_len++; + continue; + } + if (isunreserved(ascii_offset) == false) { /* This character should be escaped after all, * just let it get copied */ |