diff options
author | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-07-29 00:35:41 +0000 |
---|---|---|
committer | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-07-29 00:35:41 +0000 |
commit | c944678c3cc79704d6e16a0790e3044c0fb334a2 (patch) | |
tree | bbe2459b7483c74676fb2bad2ffb6b29580ca6ba /src/util/socks.c | |
parent | 01a8bbfb74277d3dd7f1c0e24f7ed61554658fd6 (diff) | |
download | gnunet-c944678c3cc79704d6e16a0790e3044c0fb334a2.tar.gz gnunet-c944678c3cc79704d6e16a0790e3044c0fb334a2.zip |
fixed a memleak, a static string free, an access of freed memory etc
Diffstat (limited to 'src/util/socks.c')
-rw-r--r-- | src/util/socks.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/util/socks.c b/src/util/socks.c index 1525b3c75..387c2b698 100644 --- a/src/util/socks.c +++ b/src/util/socks.c | |||
@@ -575,10 +575,7 @@ GNUNET_SOCKS_do_connect (const char *service_name, | |||
575 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT", &port0)) | 575 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT", &port0)) |
576 | port0 = 9050; | 576 | port0 = 9050; |
577 | /* A typical Tor client should usually try port 9150 for the TBB too, but | 577 | /* A typical Tor client should usually try port 9150 for the TBB too, but |
578 | * GUNNet can probably assume a system Tor instalation. */ | 578 | * GUNNet can probably assume a system Tor installation. */ |
579 | if (GNUNET_OK != | ||
580 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0)) | ||
581 | host0 = "127.0.0.1"; | ||
582 | if (port0 > 65535 || port0 <= 0) | 579 | if (port0 > 65535 || port0 <= 0) |
583 | { | 580 | { |
584 | LOG (GNUNET_ERROR_TYPE_WARNING, | 581 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -587,7 +584,6 @@ GNUNET_SOCKS_do_connect (const char *service_name, | |||
587 | port0,service_name); | 584 | port0,service_name); |
588 | return NULL; | 585 | return NULL; |
589 | } | 586 | } |
590 | |||
591 | if ((GNUNET_OK != | 587 | if ((GNUNET_OK != |
592 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port1)) | 588 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port1)) |
593 | || (port1 > 65535) || (port1 <= 0) || | 589 | || (port1 > 65535) || (port1 <= 0) || |
@@ -600,9 +596,11 @@ GNUNET_SOCKS_do_connect (const char *service_name, | |||
600 | service_name,port1,host1); | 596 | service_name,port1,host1); |
601 | return NULL; | 597 | return NULL; |
602 | } | 598 | } |
603 | 599 | if (GNUNET_OK != | |
604 | socks5 = GNUNET_CONNECTION_create_from_connect (cfg, host0, port0); | 600 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0)) |
605 | GNUNET_free (host0); | 601 | host0 = NULL; /* you don't want to feed a static string to free(), right? */ |
602 | socks5 = GNUNET_CONNECTION_create_from_connect (cfg, host0 || "127.0.0.1", port0); | ||
603 | if (host0) GNUNET_free (host0); | ||
606 | 604 | ||
607 | /* Sets to NULL if they do not exist */ | 605 | /* Sets to NULL if they do not exist */ |
608 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSUSER", &user); | 606 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSUSER", &user); |