summaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_common.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-01-18 12:23:11 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-01-18 12:23:11 +0000
commitaafe8b7d1b55adb2f4711a59d80676f1a1c85d65 (patch)
treea837eb53006e03750134aa111e45d1cd26436b2a /src/transport/plugin_transport_http_common.c
parent3a093e6f3ac520f9c3e1f8f19ff1340f40707b4c (diff)
changes
Diffstat (limited to 'src/transport/plugin_transport_http_common.c')
-rw-r--r--src/transport/plugin_transport_http_common.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index 817338426..13ac3d043 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -47,7 +47,6 @@ http_split_address (const char * addr)
char *v6_end = NULL;
char *port_start = NULL;
char *path_start = NULL;
-
protocol_start = src;
sp = GNUNET_malloc (sizeof (struct SplittedHTTPAddress));
@@ -103,6 +102,14 @@ http_split_address (const char * addr)
port_start[0] = '\0';
port_start ++;
sp->port = atoi (port_start);
+ if ((0 == sp->port) || (65535 < sp->port))
+ {
+ GNUNET_free (src);
+ GNUNET_free (sp->protocol);
+ GNUNET_free (sp->path);
+ GNUNET_free (sp);
+ return NULL;
+ }
}
else
{
@@ -119,6 +126,14 @@ http_split_address (const char * addr)
port_start[0] = '\0';
port_start ++;
sp->port = atoi (port_start);
+ if ((0 == sp->port) || (65535 < sp->port))
+ {
+ GNUNET_free (src);
+ GNUNET_free (sp->protocol);
+ GNUNET_free (sp->path);
+ GNUNET_free (sp);
+ return NULL;
+ }
}
}
else
@@ -150,7 +165,6 @@ http_split_address (const char * addr)
return NULL;
}
GNUNET_free (src);
- //fprintf (stderr, "addr: `%s' protocol: `%s', host `%s' port `%u' path `%s'\n", addr, sp->protocol, sp->host, sp->port, sp->path);
return sp;
}