gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r34888 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r34888 - gnunet/src/cadet
Date: Thu, 15 Jan 2015 15:19:57 +0100

Author: bartpolot
Date: 2015-01-15 15:19:57 +0100 (Thu, 15 Jan 2015)
New Revision: 34888

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
- Check path for NULL, fix #3583

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-01-15 14:19:56 UTC 
(rev 34887)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-01-15 14:19:57 UTC 
(rev 34888)
@@ -720,6 +720,9 @@
 {
   GNUNET_PEER_Id id;
 
+  if (NULL == c->path)
+    return NULL;
+
   LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n",
        GCC_2s (c), c->own_pos, c->path->length);
   if (0 == c->own_pos || c->path->length < 2)
@@ -746,6 +749,9 @@
 {
   GNUNET_PEER_Id id;
 
+  if (NULL == c->path)
+    return NULL;
+
   LOG (GNUNET_ERROR_TYPE_DEBUG, " get next hop %s [%u/%u]\n",
        GCC_2s (c), c->own_pos, c->path->length);
   if ((c->path->length - 1) == c->own_pos || c->path->length < 2)
@@ -2950,14 +2956,22 @@
 GCC_notify_broken (struct CadetConnection *c,
                    struct CadetPeer *peer)
 {
+  struct CadetPeer *hop;
   int fwd;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        " notify broken on %s due to %s disconnect\n",
        GCC_2s (c), GCP_2s (peer));
 
-  fwd = peer == get_prev_hop (c);
+  hop = get_prev_hop (c);
+  if (NULL == hop)
+  {
+    /* Path was NULL, we should have deleted the connection. */
+    GNUNET_break (0);
+    return;
+  }
 
+  fwd = (peer == hop);
   if (GNUNET_YES == GCC_is_terminal (c, fwd))
   {
     /* Local shutdown, no one to notify about this. */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]