[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-wget] xfree() crashes on libidn memory
From: |
Gisle Vanem |
Subject: |
[Bug-wget] xfree() crashes on libidn memory |
Date: |
Tue, 10 Feb 2015 23:27:55 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0 SeaMonkey/2.32.1 |
I got a crash in my MSVC-built Wget by "accidentally" mixing
debug and release obj/libs in my build. (libidn in debug-mode
and Wget in release-mode). So the memory returned from
'idn_decode()' in connect.c:
if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
...
xfree (name);
triggered a crash; the CRT mem-block layouts are different in
release and debug-modes. The important thing is that IDN should
free it's own memory using idn_free(). This function has been in
there since 2004!
Same problem in host.c too. Here is a patch:
--- a/connect.c 2015-02-05 15:31:22 +0000
+++ b/connect.c 2015-02-05 15:33:27 +0000
@@ -278,7 +278,7 @@
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, print);
str[len-1] = '\0';
- xfree (name);
+ idn_free (name);
}
logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
--- a/host.c 2015-02-05 15:31:22 +0000
+++ b/host.c 2015-02-03 01:57:33 +0000
@@ -741,7 +741,7 @@
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, host);
str[len-1] = '\0';
- xfree (name);
+ idn_free (name);
}
logprintf (LOG_VERBOSE, _("Resolving %s... "),
----------
This probably is alien stuff to you Unix folks. You have no
release/debug-modes to take care of (?)
--
--gv
- [Bug-wget] xfree() crashes on libidn memory,
Gisle Vanem <=