[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-wget] Misuse of idn2_free()
From: |
Gisle Vanem |
Subject: |
[Bug-wget] Misuse of idn2_free() |
Date: |
Sat, 8 Apr 2017 10:09:22 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
The 'idn_decode()' function now simply uses 'xstrdup()'.
And in host.c + connect.c there are calls to 'idn2_free()'
on this pointer:
if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
{
int len = strlen (print) + strlen (name) + 4;
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, print);
str[len-1] = '\0';
idn2_free (name); << !
}
Since the above 'name' is NOT from libidn, I get a crash when
mixing a MinGW built libidn2.dll with a MSVC built Wget.exe.
I think someone forgot to change the above code when 'idn_decode()'
got simplified. This patch works for me:
--- a/connect.c 2017-01-19 21:37:55
+++ b/connect.c 2017-04-08 09:57:24
@@ -284,7 +284,7 @@
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, print);
str[len-1] = '\0';
- idn2_free (name);
+ xfree (name);
}
logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
--- a/host.c 2017-01-19 21:37:55
+++ b/host.c 2017-04-08 10:02:42
@@ -850,7 +850,7 @@
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, host);
str[len-1] = '\0';
- idn2_free (name);
+ xfree (name);
}
logprintf (LOG_VERBOSE, _("Resolving %s... "),
--gv
- [Bug-wget] Misuse of idn2_free(),
Gisle Vanem <=