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:
parent
b6d8e1e707
commit
7259c30929
@ -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)
|
2014-10-21 Matthew Atkinson <mutley456@ntlworld.com> (tiny change)
|
||||||
|
|
||||||
* http.c (gethttp): Always send Content-Length header when method is POST,
|
* http.c (gethttp): Always send Content-Length header when method is POST,
|
||||||
|
11
src/iri.c
11
src/iri.c
@ -123,8 +123,9 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
|
|||||||
cd = iconv_open (tocode, fromcode);
|
cd = iconv_open (tocode, fromcode);
|
||||||
if (cd == (iconv_t)(-1))
|
if (cd == (iconv_t)(-1))
|
||||||
{
|
{
|
||||||
logprintf (LOG_VERBOSE, _("Conversion from %s to %s isn't supported\n"),
|
logprintf (LOG_VERBOSE, _("Conversion from %s to UTF-8 isn't supported\n"),
|
||||||
quote (opt.locale), quote ("UTF-8"));
|
quote (opt.locale));
|
||||||
|
*out = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +147,7 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
|
|||||||
*(s + len - outlen - done) = '\0';
|
*(s + len - outlen - done) = '\0';
|
||||||
xfree(in_save);
|
xfree(in_save);
|
||||||
iconv_close(cd);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
|
|||||||
|
|
||||||
xfree(in_save);
|
xfree(in_save);
|
||||||
iconv_close(cd);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ remote_to_utf8 (struct iri *iri, const char *str, const char **new)
|
|||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
/* Test if something was converted */
|
/* Test if something was converted */
|
||||||
if (!strcmp (str, *new))
|
if (*new && !strcmp (str, *new))
|
||||||
{
|
{
|
||||||
xfree ((char *) *new);
|
xfree ((char *) *new);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user