aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_http_common.c')
-rw-r--r--src/transport/plugin_transport_http_common.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index 569a47255..de4cb9a26 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -414,33 +414,40 @@ http_common_socket_from_address (const void *addr, size_t addrlen, int *res)
414 struct sockaddr_storage *s; 414 struct sockaddr_storage *s;
415 (*res) = GNUNET_SYSERR; 415 (*res) = GNUNET_SYSERR;
416 char * to_conv; 416 char * to_conv;
417 size_t urlen;
417 418
418 ha = (const struct HttpAddress *) addr; 419 ha = (const struct HttpAddress *) addr;
419 if (NULL == addr) 420 if (NULL == addr)
420 { 421 {
421 GNUNET_break (0); 422 GNUNET_break(0);
422 return NULL; 423 return NULL ;
423 } 424 }
424 if (0 >= addrlen) 425 if (0 >= addrlen)
425 { 426 {
426 GNUNET_break (0); 427 GNUNET_break(0);
427 return NULL; 428 return NULL ;
428 } 429 }
429 if (addrlen < sizeof (struct HttpAddress)) 430 if (addrlen < sizeof(struct HttpAddress))
430 { 431 {
431 GNUNET_break (0); 432 GNUNET_break(0);
432 return NULL; 433 return NULL ;
433 } 434 }
434 if (addrlen < sizeof (struct HttpAddress) + ntohl (ha->urlen)) 435 urlen = ntohl (ha->urlen);
435 { 436 if (sizeof(struct HttpAddress) + urlen != addrlen)
436 /* This is a legacy addresses */ 437 {
437 return NULL; 438 /* This is a legacy addresses */
438 } 439 return NULL ;
439 if (((char *) addr)[addrlen-1] != '\0') 440 }
440 { 441 if (addrlen < sizeof(struct HttpAddress) + urlen)
441 GNUNET_break (0); 442 {
442 return NULL; 443 /* This is a legacy addresses */
443 } 444 return NULL ;
445 }
446 if (((char *) addr)[addrlen - 1] != '\0')
447 {
448 GNUNET_break(0);
449 return NULL ;
450 }
444 spa = http_split_address ((const char *) &ha[1]); 451 spa = http_split_address ((const char *) &ha[1]);
445 if (NULL == spa) 452 if (NULL == spa)
446 { 453 {