[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37604 - in gnunet: contrib src/cadet src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37604 - in gnunet: contrib src/cadet src/util |
Date: |
Fri, 29 Jul 2016 02:35:41 +0200 |
Author: lynx
Date: 2016-07-29 02:35:41 +0200 (Fri, 29 Jul 2016)
New Revision: 37604
Modified:
gnunet/contrib/gnunet-logread
gnunet/src/cadet/gnunet-service-cadet_connection.c
gnunet/src/cadet/gnunet-service-cadet_peer.c
gnunet/src/cadet/gnunet-service-cadet_tunnel.c
gnunet/src/util/socks.c
Log:
fixed a memleak, a static string free, an access of freed memory etc
Modified: gnunet/contrib/gnunet-logread
===================================================================
--- gnunet/contrib/gnunet-logread 2016-07-28 23:36:38 UTC (rev 37603)
+++ gnunet/contrib/gnunet-logread 2016-07-29 00:35:41 UTC (rev 37604)
@@ -45,7 +45,7 @@
Could not read $filename for message codes:
$!.
Please provide a \$GNUNET_PREFIX environment variable to replace "/usr".
-Try also '$0 -h' for help
+Try also '$0 -h' for help.
X
}
@@ -186,7 +186,7 @@
That master process is simply an extra gnunet-logread that you run in a
separate window and adorn it with the '-f' flag. The submitting processes
instead need to be given a '-n' flag. That is because from the GNUnet logs
-it isn't clear which process events belong too. For example you may be
+it isn't clear which process events belong to. For example you may be
having events taking place in the 'util' subsystem of gnunet-psyc-service
just as much as in the 'util' subsystem of gnunet-multicast-service. In
order to make sense of them it is necessary to manually add that info. This
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2016-07-28 23:36:38 UTC
(rev 37603)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2016-07-29 00:35:41 UTC
(rev 37604)
@@ -3482,6 +3482,13 @@
int droppable;
GCC_check_connections ();
+ fc = fwd ? &c->fwd_fc : &c->bck_fc;
+ if (0 == fc->queue_max)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+
size = ntohs (message->size);
data = GNUNET_malloc (size);
GNUNET_memcpy (data, message, size);
@@ -3490,13 +3497,6 @@
"--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c,
GC_f2s(fwd), size);
-
- fc = fwd ? &c->fwd_fc : &c->bck_fc;
- if (0 == fc->queue_max)
- {
- GNUNET_break (0);
- return NULL;
- }
droppable = GNUNET_NO == force;
switch (type)
{
Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c 2016-07-28 23:36:38 UTC
(rev 37603)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c 2016-07-29 00:35:41 UTC
(rev 37604)
@@ -787,7 +787,12 @@
GNUNET_ATS_connectivity_suggest_cancel (peer->connectivity_suggestion);
peer->connectivity_suggestion = NULL;
}
- while (NULL != peer->queue_head)
+ /* Following check was 'while' instead of 'if', but GCP_queue_destroy
+ * frees 'peer->queue_head' so the while checks on freed memory.
+ * Not sure if 'if' is what you wanted, but 'while' can't be
+ * correct. --lynX
+ */
+ if (NULL != peer->queue_head)
{
GCP_queue_destroy (peer->queue_head, GNUNET_YES, GNUNET_NO, 0);
}
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2016-07-28 23:36:38 UTC
(rev 37603)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2016-07-29 00:35:41 UTC
(rev 37604)
@@ -4252,6 +4252,7 @@
{
continue;
}
+ GNUNET_assert(cs != 0);
allow_per_connection = to_allow/cs;
to_allow -= allow_per_connection;
cs--;
Modified: gnunet/src/util/socks.c
===================================================================
--- gnunet/src/util/socks.c 2016-07-28 23:36:38 UTC (rev 37603)
+++ gnunet/src/util/socks.c 2016-07-29 00:35:41 UTC (rev 37604)
@@ -575,10 +575,7 @@
GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT",
&port0))
port0 = 9050;
/* A typical Tor client should usually try port 9150 for the TBB too, but
- * GUNNet can probably assume a system Tor instalation. */
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST",
&host0))
- host0 = "127.0.0.1";
+ * GUNNet can probably assume a system Tor installation. */
if (port0 > 65535 || port0 <= 0)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -587,7 +584,6 @@
port0,service_name);
return NULL;
}
-
if ((GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT",
&port1))
|| (port1 > 65535) || (port1 <= 0) ||
@@ -600,10 +596,12 @@
service_name,port1,host1);
return NULL;
}
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST",
&host0))
+ host0 = NULL; /* you don't want to feed a static string to free(), right?
*/
+ socks5 = GNUNET_CONNECTION_create_from_connect (cfg, host0 || "127.0.0.1",
port0);
+ if (host0) GNUNET_free (host0);
- socks5 = GNUNET_CONNECTION_create_from_connect (cfg, host0, port0);
- GNUNET_free (host0);
-
/* Sets to NULL if they do not exist */
GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSUSER",
&user);
GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSPASS",
&pass);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37604 - in gnunet: contrib src/cadet src/util,
gnunet <=