[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Misuse of idn2_free()
From: |
Tim Rühsen |
Subject: |
Re: [Bug-wget] Misuse of idn2_free() |
Date: |
Sat, 08 Apr 2017 11:12:27 +0200 |
User-agent: |
KMail/5.2.3 (Linux/4.9.0-2-amd64; KDE/5.28.0; x86_64; ; ) |
Thanks, Gisle.
pushed with several additional fixes/cleanups regarding idn2.
Regards, Tim
On Samstag, 8. April 2017 10:09:22 CEST Gisle Vanem wrote:
> 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
signature.asc
Description: This is a digitally signed message part.