]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/jwhois-4.0-idna.patch
python3-msgpack: Fix build on i586
[people/pmueller/ipfire-2.x.git] / src / patches / jwhois-4.0-idna.patch
1 diff -up jwhois-4.0/src/jwhois.c.orig jwhois-4.0/src/jwhois.c
2 --- jwhois-4.0/src/jwhois.c.orig 2007-06-26 08:59:35.000000000 +0200
3 +++ jwhois-4.0/src/jwhois.c 2011-05-24 12:29:37.398892451 +0200
4 @@ -98,7 +98,7 @@ main(int argc, char **argv)
5
6 /* Parse remaining arguments and place them into the wq
7 structure. */
8 - while (optind < argc)
9 + while (optind < argc-1)
10 {
11 count += strlen(argv[optind])+1;
12 if (!qstring)
13 @@ -116,19 +116,25 @@ main(int argc, char **argv)
14 strcat(qstring, " ");
15 optind++;
16 }
17 - qstring[strlen(qstring)-1] = '\0';
18 #ifdef LIBIDN
19 - rc = idna_to_ascii_lz(qstring, &idn, 0);
20 + rc = idna_to_ascii_lz(argv[optind], &idn, 0);
21 if (rc != IDNA_SUCCESS)
22 {
23 - printf("[IDN encoding of '%s' failed with error code %d]\n", qstring, rc);
24 + printf("[IDN encoding of '%s' failed with error code %d]\n", argv[optind], rc);
25 exit(1);
26 }
27 - wq.query = strdup(idn);
28 + qstring = realloc(qstring, count+strlen(idn)+1);
29 + memcpy(qstring+count,
30 + idn,
31 + strlen(idn)+1);
32 free(idn);
33 #else
34 - wq.query = qstring;
35 + qstring = realloc(qstring, count+strlen(argv[optind])+1);
36 + memcpy(qstring+count,
37 + argv[optind],
38 + strlen(argv[optind])+1);
39 #endif
40 + wq.query = qstring;
41
42 if (ghost)
43 {