On Tuesday 04 November 2014 12:02:08 Mikael Magnusson wrote:
> % wget --local-encoding=blorp google.com
> Conversion from 'blorp' to 'blorp' isn't supported
> zsh: segmentation fault wget --local-encoding=blorp google.com
>
> (the message should say to 'UTF-8').
>
> % wget --local-encoding= google.com
> converted 'http://google.com' () -> 'http://google.com' (UTF-8)
> ...
> 2014-11-04 09:00:22 (590 KB/s) - 'index.html' saved [17800]
>
> It's unclear what this conversion does.
Thanks for reporting, Mikael.
The 'converted' messages were meant as debug messages. The somehow dropped
into a commit.
The appended patch fixes the sigfault und changes the 'converted' messages
into DEBUG ones. Also the 'Conversion from...' message has been fixed.
Tim
From 15ac4c23912dae187b9887c960321e76b27d75b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim Rühsen?=
Date: Tue, 4 Nov 2014 12:48:25 +0100
Subject: [PATCH] * iri.c (remote_to_utf8): fix crash on do_conversion()
failure
---
src/ChangeLog | 5 +
src/iri.c | 11 ++-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 5ad7605..dbf7d9b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-04 Tim Ruehsen
+
+ * iri.c (do_conversion): fix quote() misuse
+ * iri.c (remote_to_utf8): fix segfault on do_conversion() error
+
2014-11-03 Jakub Čajka
* iri.c (remote_to_utf8): Fixed assumption that char is signed. Fixes
diff --git a/src/iri.c b/src/iri.c
index 11f2bda..dd2806d 100644
--- a/src/iri.c
+++ b/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);
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;
--
2.1.1
signature.asc
Description: This is a digitally signed message part.