summaryrefslogtreecommitdiff
path: root/hostport.c
diff options
context:
space:
mode:
authorvenaas <venaas>2009-01-27 15:45:48 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2009-01-27 15:45:48 +0000
commit9f542fc2c8905be58015a428f0240ebff20658ef (patch)
tree634826a339ca263c4531ca83278a3872b9aa7da4 /hostport.c
parent2e4e8b5fd240d7f3647ba662b43d4e28f62260d7 (diff)
fixed bug in new hostport code with NULL hostname
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@463 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'hostport.c')
-rw-r--r--hostport.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hostport.c b/hostport.c
index 00c31c8..b392346 100644
--- a/hostport.c
+++ b/hostport.c
@@ -28,6 +28,10 @@ static int parsehostport(struct hostportres *hp, char *hostport, char *default_p
char *p, *field;
int ipv6 = 0;
+ if (!hostport) {
+ hp->port = default_port ? stringcopy(default_port, 0) : NULL;
+ return 1;
+ }
p = hostport;
/* allow literal addresses and port, e.g. [2001:db8::1]:1812 */
if (*p == '[') {
@@ -85,7 +89,7 @@ static struct hostportres *newhostport(char *hostport, char *default_port, uint8
if (!parsehostport(hp, hostport, default_port))
goto errexit;
- if (!strcmp(hp->host, "*")) {
+ if (hp->host && !strcmp(hp->host, "*")) {
free(hp->host);
hp->host = NULL;
}