[jwhois/f14/master] Fix IDN encoding failed with error code 5

vcrhonek vcrhonek at fedoraproject.org
Tue Mar 15 13:18:17 UTC 2011


commit baf6318b5d00dd8bbf6bd26d4114dae021faeb08
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date:   Tue Mar 15 14:18:14 2011 +0100

    Fix IDN encoding failed with error code 5

 jwhois-4.0-idna.patch |   42 ++++++++++++++++++++++++++++++++++++++++++
 jwhois.spec           |    8 +++++++-
 2 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/jwhois-4.0-idna.patch b/jwhois-4.0-idna.patch
new file mode 100644
index 0000000..08ee189
--- /dev/null
+++ b/jwhois-4.0-idna.patch
@@ -0,0 +1,42 @@
+diff -up jwhois-4.0/src/jwhois.c.orig jwhois-4.0/src/jwhois.c
+--- jwhois-4.0/src/jwhois.c.orig	2007-06-26 08:59:35.000000000 +0200
++++ jwhois-4.0/src/jwhois.c	2011-03-14 16:57:35.443315688 +0100
+@@ -98,7 +98,7 @@ main(int argc, char **argv)
+ 
+   /* Parse remaining arguments and place them into the wq
+      structure. */
+-  while (optind < argc)
++  while (optind < argc-1)
+     {
+       count += strlen(argv[optind])+1;
+       if (!qstring)
+@@ -116,19 +116,25 @@ main(int argc, char **argv)
+       strcat(qstring, " ");
+       optind++;
+     }
+-  qstring[strlen(qstring)-1] = '\0';
+ #ifdef LIBIDN
+-  rc = idna_to_ascii_lz(qstring, &idn, 0);
++  rc = idna_to_ascii_lz(argv[optind], &idn, 0);
+   if (rc != IDNA_SUCCESS)
+     {
+       printf("[IDN encoding of '%s' failed with error code %d]\n", qstring, rc);
+       exit(1);
+     }
+-  wq.query = strdup(idn);
++  qstring = realloc(qstring, count+strlen(idn)+1);
++  memcpy(qstring+count,
++         idn,
++         strlen(idn)+1);
+   free(idn);
+ #else
+-  wq.query = qstring;
++  qstring = realloc(qstring, count+strlen(argv[optind])+1);
++  memcpy(qstring+count,
++         argv[optind],
++         strlen(argv[optind])+1);
+ #endif
++  wq.query = qstring;
+ 
+   if (ghost)
+     {
diff --git a/jwhois.spec b/jwhois.spec
index 05c03a8..de1e2e9 100644
--- a/jwhois.spec
+++ b/jwhois.spec
@@ -2,7 +2,7 @@
 
 Name: jwhois
 Version: 4.0
-Release: 23%{?dist}
+Release: 24%{?dist}
 URL: http://www.gnu.org/software/jwhois/
 Source0: ftp://ftp.gnu.org/gnu/jwhois/jwhois-%{version}.tar.gz
 Patch0: jwhois-4.0-connect.patch
@@ -11,6 +11,7 @@ Patch2: jwhois-4.0-fclose.patch
 Patch3: jwhois-4.0-select.patch
 Patch4: jwhois-4.0-conf_update.patch
 Patch5: jwhois-4.0-multi-homed.patch
+Patch6: jwhois-4.0-idna.patch
 License: GPLv3
 Group: Applications/Internet
 Summary: Internet whois/nicname client
@@ -33,6 +34,7 @@ A whois client that accepts both traditional and finger-style queries.
 %patch3 -p1 -b .select
 %patch4 -p1 -b .conf_update
 %patch5 -p1 -b .multi-homed
+%patch6 -p1 -b .idna
 
 iconv -f iso-8859-1 -t utf-8 < doc/sv/jwhois.1 > doc/sv/jwhois.1_
 mv doc/sv/jwhois.1_ doc/sv/jwhois.1
@@ -98,6 +100,10 @@ fi
 rm -fr $RPM_BUILD_ROOT
 
 %changelog
+* Tue Mar 15 2011 Vitezslav Crhonek <vcrhonek at redhat.com> - 4.0-24
+- Fix IDN encoding failed with error code 5
+  Resolves: #682841
+
 * Tue Nov  9 2010 Vitezslav Crhonek <vcrhonek at redhat.com> - 4.0-23
 - Disable cache (it was accidentally enabled by default)
   Resolves: #650620


More information about the scm-commits mailing list