diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2016-03-26 14:41:35 -0400 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2016-03-26 14:41:35 -0400 |
commit | 3d144ab99bed3ad9af1179c50f1df6334350aa98 (patch) | |
tree | 39824259e878541f30ecdcb51ff56ca84ef77fbe /lib/url.c | |
parent | 4adee1947c8016359fb7ae01dd3998166ea0101a (diff) | |
download | curl-3d144ab99bed3ad9af1179c50f1df6334350aa98.tar.gz |
url: don't use bad offset in tld_check_name to show error
libidn's tld_check_lz returns an error offset of the first character
that it failed to process, however that offset is not a byte offset and
may not even be in the locale encoding therefore we can't use it to show
the user the character that failed to process.
Bug: https://github.com/curl/curl/issues/731
Reported-by: Karlson2k
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -3728,17 +3728,16 @@ static bool tld_check_name(struct SessionHandle *data, if(rc != IDNA_SUCCESS) return FALSE; + /* Warning: err_pos receives "the decoded character offset rather than the + byte position in the string." And as of libidn 1.32 that character offset + is for UTF-8, even if the passed in string is another locale. */ rc = tld_check_lz(uc_name, &err_pos, NULL); #ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef HAVE_TLD_STRERROR if(rc != TLD_SUCCESS) tld_errmsg = tld_strerror((Tld_rc)rc); #endif - if(rc == TLD_INVALID) - infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n", - tld_errmsg, err_pos, uc_name[err_pos], - uc_name[err_pos] & 255); - else if(rc != TLD_SUCCESS) + if(rc != TLD_SUCCESS) infof(data, "WARNING: TLD check for %s failed; %s\n", uc_name, tld_errmsg); #endif /* CURL_DISABLE_VERBOSE_STRINGS */ |