[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34586 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34586 - gnunet/src/cadet |
Date: |
Mon, 15 Dec 2014 08:17:48 +0100 |
Author: bartpolot
Date: 2014-12-15 08:17:48 +0100 (Mon, 15 Dec 2014)
New Revision: 34586
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
gnunet/src/cadet/gnunet-service-cadet_connection.h
Log:
Fix memory corruption: new connection always makes copy of path.
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2014-12-15 07:17:46 UTC
(rev 34585)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2014-12-15 07:17:48 UTC
(rev 34586)
@@ -1607,7 +1607,7 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
- c = GCC_new (cid, NULL, path_duplicate (path), own_pos);
+ c = GCC_new (cid, NULL, path, own_pos);
if (NULL == c)
{
if (path->length - 1 == own_pos)
@@ -2470,14 +2470,26 @@
}
+/**
+ * Create a connection.
+ *
+ * @param cid Connection ID (either created locally or imposed remotely).
+ * @param t Tunnel this connection belongs to (or NULL);
+ * @param path Path this connection has to use (copy is made).
+ * @param own_pos Own position in the @c path path.
+ *
+ * @return Newly created connection, NULL in case of error (own id not in
path).
+ */
struct CadetConnection *
GCC_new (const struct GNUNET_CADET_Hash *cid,
struct CadetTunnel *t,
- struct CadetPeerPath *p,
+ struct CadetPeerPath *path,
unsigned int own_pos)
{
struct CadetConnection *c;
+ struct CadetPeerPath *p;
+ p = path_duplicate (path);
c = GNUNET_new (struct CadetConnection);
c->id = *cid;
GNUNET_assert (GNUNET_OK ==
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.h 2014-12-15 07:17:46 UTC
(rev 34585)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.h 2014-12-15 07:17:48 UTC
(rev 34586)
@@ -265,15 +265,15 @@
*
* @param cid Connection ID (either created locally or imposed remotely).
* @param t Tunnel this connection belongs to (or NULL);
- * @param p Path this connection has to use.
- * @param own_pos Own position in the @c p path.
+ * @param path Path this connection has to use (copy is made).
+ * @param own_pos Own position in the @c path path.
*
* @return Newly created connection, NULL in case of error (own id not in
path).
*/
struct CadetConnection *
GCC_new (const struct GNUNET_CADET_Hash *cid,
struct CadetTunnel *t,
- struct CadetPeerPath *p,
+ struct CadetPeerPath *path,
unsigned int own_pos);
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34586 - gnunet/src/cadet,
gnunet <=