summaryrefslogtreecommitdiff
path: root/whois.c
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2006-07-19 21:01:32 +0200
committerMarco d'Itri <md@linux.it>2013-03-30 02:31:34 +0100
commit7c5dbcc6c6607a113e3414483d9f2b23f55d5070 (patch)
tree33e89334ef537aebae8968c3ed2b6f6232967d8c /whois.c
parent6077928ad947f17e29dabae38a2edb24f0e319bd (diff)
downloadwhois-7c5dbcc6c6607a113e3414483d9f2b23f55d5070.tar.gz
Imported Debian version 4.7.15v4.7.15
Diffstat (limited to 'whois.c')
-rw-r--r--whois.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/whois.c b/whois.c
index 73c1485..3d52e72 100644
--- a/whois.c
+++ b/whois.c
@@ -802,7 +802,7 @@ void split_server_port(const char *const input,
if (p && *(p + 1) != '\0')
*port = strdup(p + 1); /* IPv6 + port */
} else if ((p = strchr(input, ':')) && /* IPv6, no port */
- strchr(p, ':')) { /* and no brackets */
+ strchr(p + 1, ':')) { /* and no brackets */
*server = strdup(input);
} else if ((p = strchr(input, ':'))) { /* IPv4 + port */
char *s;
@@ -812,8 +812,9 @@ void split_server_port(const char *const input,
memcpy(s, input, len);
*(s + len) = '\0';
- if (*(p + 1) != '\0')
- *port = strdup(p + 1);
+ p++;
+ if (*p != '\0')
+ *port = strdup(p);
} else { /* IPv4, no port */
*server = strdup(input);
}