diff options
Diffstat (limited to 'src/transport/plugin_transport_http_common.c')
-rw-r--r-- | src/transport/plugin_transport_http_common.c | 18 |
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) | |||
47 | char *v6_end = NULL; | 47 | char *v6_end = NULL; |
48 | char *port_start = NULL; | 48 | char *port_start = NULL; |
49 | char *path_start = NULL; | 49 | char *path_start = NULL; |
50 | |||
51 | protocol_start = src; | 50 | protocol_start = src; |
52 | sp = GNUNET_malloc (sizeof (struct SplittedHTTPAddress)); | 51 | sp = GNUNET_malloc (sizeof (struct SplittedHTTPAddress)); |
53 | 52 | ||
@@ -103,6 +102,14 @@ http_split_address (const char * addr) | |||
103 | port_start[0] = '\0'; | 102 | port_start[0] = '\0'; |
104 | port_start ++; | 103 | port_start ++; |
105 | sp->port = atoi (port_start); | 104 | sp->port = atoi (port_start); |
105 | if ((0 == sp->port) || (65535 < sp->port)) | ||
106 | { | ||
107 | GNUNET_free (src); | ||
108 | GNUNET_free (sp->protocol); | ||
109 | GNUNET_free (sp->path); | ||
110 | GNUNET_free (sp); | ||
111 | return NULL; | ||
112 | } | ||
106 | } | 113 | } |
107 | else | 114 | else |
108 | { | 115 | { |
@@ -119,6 +126,14 @@ http_split_address (const char * addr) | |||
119 | port_start[0] = '\0'; | 126 | port_start[0] = '\0'; |
120 | port_start ++; | 127 | port_start ++; |
121 | sp->port = atoi (port_start); | 128 | sp->port = atoi (port_start); |
129 | if ((0 == sp->port) || (65535 < sp->port)) | ||
130 | { | ||
131 | GNUNET_free (src); | ||
132 | GNUNET_free (sp->protocol); | ||
133 | GNUNET_free (sp->path); | ||
134 | GNUNET_free (sp); | ||
135 | return NULL; | ||
136 | } | ||
122 | } | 137 | } |
123 | } | 138 | } |
124 | else | 139 | else |
@@ -150,7 +165,6 @@ http_split_address (const char * addr) | |||
150 | return NULL; | 165 | return NULL; |
151 | } | 166 | } |
152 | GNUNET_free (src); | 167 | GNUNET_free (src); |
153 | //fprintf (stderr, "addr: `%s' protocol: `%s', host `%s' port `%u' path `%s'\n", addr, sp->protocol, sp->host, sp->port, sp->path); | ||
154 | return sp; | 168 | return sp; |
155 | } | 169 | } |
156 | 170 | ||