Commit Graph

56 Commits

Author SHA1 Message Date
Tim Rühsen cbbeca2af4 Cleanup code
* src/iri.c (do_conversion): Code cleanup
2015-12-17 21:01:50 +01:00
Tim Rühsen be7d19f478 Fix iconv conversion
* src/iri.c: Kick out the last converted character from iconv()

Thanks to Eli Zaretskii <eliz@gnu.org> for suggesting the fix.
Reported-by: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
2015-12-15 10:55:41 +01:00
Tim Rühsen 88a1a79bc1 Fix leaks found by Coverity
* src/http.c (parse_strict_transport_security): Free c_max_age
             (open_output_stream): Fix indentation
* src/iri.c (locale_to_utf8): Free new
2015-08-30 14:10:25 +02:00
Tim Rühsen 7bed9a6f8f Suppress debug output when strings may contain password
* iri.c (do_conversion): Do not print out converted strings if they
  contain an '@'. That could be an URL with embedded password.

Fixes #45825
2015-08-27 09:55:13 +02:00
Tim Rühsen 25c9b462bf Change function params to const in src/iri.[ch]
* iri.h, iri.c: Added const attribute for params of parse_charsset(),
	check_encoding_name(), idn_encode(), idn_decode(),
	remote_to_utf8(), set_uri_encoding(), set_content_encoding().
2015-07-01 17:15:10 +02:00
Tim Rühsen 77f5a27e65 Work around a libidn <= 1.30 vulnerability
* src/iri.c: Add _utf8_is_valid() to check UTF-8 sequences before
  passing them to idna_to_ascii_8z().
2015-07-01 17:15:05 +02:00
Ander Juaristi b0820d553b Fixed incorrect handling of reserved chars.
* src/iri.c (do_conversion): Call url_unescape_except_reserved,
instead of url_unescape.

* src/url.c (url_unescape_1): New static function.
(url_unescape): Calls url_unescape_1 with mask zero. Preserves
same behavior as before. Only code changes.
(url_unescape_except_reserved): New function.

* src/url.h: Added prototype for url_unescape_except_reserved().

When the locale is US-ASCII, URIs that contain special characters
in them are converted to IRIs according to RFC 3987, section 3.2
"Converting URIs to IRIs".
2015-05-12 21:24:06 +02:00
Ángel González bef5945202 Remove memory leak in idn_encode.
* src/iri.c (idn_encode): Free buffer from remote_to_utf8
when needed; give meaningful names to variables;
remove excessive comment.
2015-04-11 21:55:17 +02:00
Ángel González 45463eaad7 Fix const usage in iri.c
* src/iri.c (remote_to_utf8): Do not qualify with const the output pointer.
(do_conversion): Use the provided input parameter as const.
(idn_encode): casts to remote_to_utf8 parameters are no longer needed.
* src/iri.h: Adjusted remote_to_utf8 prototype.
* src/url.c: It is no longer necessary to cast new_url to const char.
2015-04-10 10:23:01 +02:00
Giuseppe Scrivano 16f1fb1d1f maint: update copyright year ranges to include 2015 2015-03-09 16:32:01 +01:00
Gisle Vanem 9df2250f4c idn: use idn_free() to free allocated libidn memory
xfree() might crash on libidn memory on Windows.

From 'man idn_free':
"Under Windows, different parts of the same application may use different
 heap memory, and then it is important to deallocate memory allocated within
 the same  module  that  allocated it. This function makes that possible."
2015-02-18 12:50:57 +01:00
Tim Rühsen eb0789d43f src/iri.c: Call xstrndup instead of strndup
strndup() does not exist in some older C libraries, also xstrndup()
exits on memory allocation failures.
2014-12-12 16:15:51 +01:00
Tim Rühsen cbaabe78e8 src/iri.c: Use c_strcasestr instead of strcasestr
This also fixes a problem with strcasestr not being in the
boostrap.conf module list.

Reported-by: Kiyoshi KANAZAWA <yoi_no_myoujou@yahoo.co.jp>
2014-12-12 15:45:32 +01:00
Tim Rühsen e4583ab364 Fix issues reported by static code analysis tool 'parfait'
Closes: #41235
Reported-by: Jiri Kukacka
2014-12-01 20:39:44 +01:00
Tim Ruehsen 4850e9c873 Replaced xfree_null() by xfree() and nullify argument after freeing. 2014-12-01 16:15:37 +01:00
Daniel Stenberg 09d47ead18 Fix compiler warning in src/iri.c 2014-11-21 10:43:14 +01:00
Darshit Shah 00203b2888 Revert "remote_to_utf8: cut off part of condition always false"
This reverts commit 1553c70961.

Some architectures like arm64 and ppc64 have unsigned chars where this
commit will cause problems.
2014-11-21 14:19:48 +05:30
Daniel Stenberg 1553c70961 remote_to_utf8: cut off part of condition always false
A signed char is never larger than 127.
2014-11-21 13:59:04 +05:30
Tim Rühsen 7b43510fe3 Fixes possible issues with Wget running in a turkish locale 2014-11-20 10:56:21 +01:00
Tim Ruehsen 7259c30929 Fix segmentation fault on do_conversion() failure
Having an unknown local encoding made Wget crash.
We also fix a wrong 'Conversion from ...' message and
changed two logging messages into debug messages.

Reported-by: Mikael Magnusson <mikachu@gmail.com>
2014-11-05 21:57:18 +01:00
Jakub Čajka 981c7456ff * iri.c (remote_to_utf8): Fixed assumption that char is signed.
Fixes fellowing test case failures idn-cmd-utf8, idn-robots-utf8,
if char is unsigned.
2014-11-03 15:43:55 +01:00
Tim Rühsen bc347cc36f fixed IRI misbehaviour(s) 2014-10-20 08:53:12 +02:00
Tomas Hozza e43ae39dff Fix checking of iconv_open return code.
Based on libiconv documentation, the iconv_open function returns
(iconv_t)(-1).

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2014-07-08 17:01:17 +02:00
Giuseppe Scrivano dd1b69c600 Remove trailing empty lines 2014-06-12 18:49:15 +02:00
Tim Ruehsen 38a7829dcb Fix compiler warnings 2014-05-12 12:18:50 +02:00
Merinov Nikolay 37c85ecba3 Fix problem with IDN and UTF-8 encoding. 2011-07-26 09:27:08 +02:00
Giuseppe Scrivano 2f6aa1d741 mass change: update copyright years. 2011-01-01 13:19:37 +01:00
Giuseppe Scrivano 260b9593dc Remove an unused function and an unused local variable. 2010-05-31 11:51:27 +02:00
Giuseppe Scrivano 293008f682 Mass update copyright years. 2010-05-08 21:56:15 +02:00
Micah Cowan 4a08094db8 [mq]: cfg-mk 2009-09-21 20:39:44 -07:00
Micah Cowan b9e9ad65cc Ran update-copyright. 2009-09-04 00:13:47 -07:00
Marcel Telka a9a2b34b05 "invalide" -> "invalid" 2009-07-27 19:58:06 -07:00
Micah Cowan 1d82a5464e Mark some iri.c strings for translation. 2009-07-05 09:46:13 -07:00
Micah Cowan 44cde778dd Fix Test-iri-list. 2009-06-29 01:07:12 -07:00
Saint Xavier 66dd4bda74 IRI requirement: do not percent-encode already percent-encoded values (try1) 2008-09-27 11:13:21 +02:00
Saint Xavier 1063191b33 Fix a double quoting 2008-08-15 14:41:15 +02:00
Xavier Saint 84395897ad iri.h is already included in wget.h, so don't include it in C files 2008-08-04 11:08:33 +02:00
Xavier Saint c74bc2da70 Some cleanups in iri.c 2008-08-03 22:30:12 +02:00
Xavier Saint bfd8a73f00 quote*() functions don't like that much NULL arg 2008-08-02 11:22:14 +02:00
Xavier Saint b967d49f79 opt.remote_encoding should not override opt.locale, add a force arguments to set_uri_encoding() 2008-07-30 10:15:55 +02:00
Saint Xavier 3ae04f5fe4 Use DEBUGP instead of commenting out all the _wonderful_ printfs 2008-07-24 14:32:31 +02:00
Saint Xavier d82f80ecab Change global variable model for state-object 2008-07-24 00:56:29 +02:00
Saint Xavier c31e00b52d Do not free/duplicate current/remote encoding string if they aren't changed 2008-07-21 19:34:22 +02:00
Saint Xavier 5982054a98 Use the right flags for idna conversion (RFC3987 section 3.1) 2008-07-20 20:37:22 +02:00
Saint Xavier 169a16fc7d Make get_utf8_encode() directly aware of ugly_no_encode and remove get_ugly_no_encode() 2008-07-20 19:29:51 +02:00
Saint Xavier 24d68b7a25 Add some comments in iri.c and change a variable name which was the same for a global and a local one 2008-07-20 19:08:28 +02:00
Saint Xavier 1e9ced0170 Get rid of the supplementary bool pointer in url_parse () arguments; UGLY :) 2008-07-20 18:47:52 +02:00
Saint Xavier 9a2ea3938d Basic IDN/IRI support 2008-07-20 13:10:02 +02:00
Saint Xavier 99396653c2 Show also the hostname in the locale when possible 2008-07-02 16:37:28 +02:00
Saint Xavier 85185bde1b Emit a message if we found invalid or incomplete multibyte sequences 2008-07-01 19:34:37 +02:00