aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c14
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c7
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c1
-rw-r--r--src/util/socks.c14
4 files changed, 20 insertions, 16 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 9dfecf043..babb00d66 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -3482,6 +3482,13 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3482 int droppable; 3482 int droppable;
3483 3483
3484 GCC_check_connections (); 3484 GCC_check_connections ();
3485 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3486 if (0 == fc->queue_max)
3487 {
3488 GNUNET_break (0);
3489 return NULL;
3490 }
3491
3485 size = ntohs (message->size); 3492 size = ntohs (message->size);
3486 data = GNUNET_malloc (size); 3493 data = GNUNET_malloc (size);
3487 GNUNET_memcpy (data, message, size); 3494 GNUNET_memcpy (data, message, size);
@@ -3490,13 +3497,6 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3490 "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n", 3497 "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
3491 GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c, 3498 GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c,
3492 GC_f2s(fwd), size); 3499 GC_f2s(fwd), size);
3493
3494 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3495 if (0 == fc->queue_max)
3496 {
3497 GNUNET_break (0);
3498 return NULL;
3499 }
3500 droppable = GNUNET_NO == force; 3500 droppable = GNUNET_NO == force;
3501 switch (type) 3501 switch (type)
3502 { 3502 {
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index e19c3ca48..fa338f13f 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -787,7 +787,12 @@ peer_destroy (struct CadetPeer *peer)
787 GNUNET_ATS_connectivity_suggest_cancel (peer->connectivity_suggestion); 787 GNUNET_ATS_connectivity_suggest_cancel (peer->connectivity_suggestion);
788 peer->connectivity_suggestion = NULL; 788 peer->connectivity_suggestion = NULL;
789 } 789 }
790 while (NULL != peer->queue_head) 790 /* Following check was 'while' instead of 'if', but GCP_queue_destroy
791 * frees 'peer->queue_head' so the while checks on freed memory.
792 * Not sure if 'if' is what you wanted, but 'while' can't be
793 * correct. --lynX
794 */
795 if (NULL != peer->queue_head)
791 { 796 {
792 GCP_queue_destroy (peer->queue_head, GNUNET_YES, GNUNET_NO, 0); 797 GCP_queue_destroy (peer->queue_head, GNUNET_YES, GNUNET_NO, 0);
793 } 798 }
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index bdb8a8ea4..565ddf411 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -4252,6 +4252,7 @@ GCT_send_connection_acks (struct CadetTunnel *t)
4252 { 4252 {
4253 continue; 4253 continue;
4254 } 4254 }
4255 GNUNET_assert(cs != 0);
4255 allow_per_connection = to_allow/cs; 4256 allow_per_connection = to_allow/cs;
4256 to_allow -= allow_per_connection; 4257 to_allow -= allow_per_connection;
4257 cs--; 4258 cs--;
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);