1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

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>
This commit is contained in:
Tim Ruehsen 2014-11-05 21:57:18 +01:00
parent b6d8e1e707
commit 7259c30929
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2014-11-04 Tim Ruehsen <tim.ruehsen@gmx.de>
* iri.c (do_conversion): fix quote() misuse
* iri.c (remote_to_utf8): fix segfault on do_conversion() error
Reported-by: Mikael Magnusson <mikachu@gmail.com>
2014-10-21 Matthew Atkinson <mutley456@ntlworld.com> (tiny change)
* http.c (gethttp): Always send Content-Length header when method is POST,

View File

@ -123,8 +123,9 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
cd = iconv_open (tocode, fromcode);
if (cd == (iconv_t)(-1))
{
logprintf (LOG_VERBOSE, _("Conversion from %s to %s isn't supported\n"),
quote (opt.locale), quote ("UTF-8"));
logprintf (LOG_VERBOSE, _("Conversion from %s to UTF-8 isn't supported\n"),
quote (opt.locale));
*out = NULL;
return false;
}
@ -146,7 +147,7 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
*(s + len - outlen - done) = '\0';
xfree(in_save);
iconv_close(cd);
logprintf (LOG_VERBOSE, _("converted '%s' (%s) -> '%s' (%s)\n"), in_org, fromcode, *out, tocode);
DEBUGP (("converted '%s' (%s) -> '%s' (%s)\n", in_org, fromcode, *out, tocode));
return true;
}
@ -187,7 +188,7 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
xfree(in_save);
iconv_close(cd);
logprintf (LOG_VERBOSE, _("converted '%s' (%s) -> '%s' (%s)\n"), in_org, fromcode, *out, tocode);
DEBUGP (("converted '%s' (%s) -> '%s' (%s)\n", in_org, fromcode, *out, tocode));
return false;
}
@ -291,7 +292,7 @@ remote_to_utf8 (struct iri *iri, const char *str, const char **new)
ret = true;
/* Test if something was converted */
if (!strcmp (str, *new))
if (*new && !strcmp (str, *new))
{
xfree ((char *) *new);
return false;