aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-01-15 14:19:57 +0000
committerBart Polot <bart@net.in.tum.de>2015-01-15 14:19:57 +0000
commitc12b21f9592f5f5f4714ba892f4cb334db16afb6 (patch)
treedead4c13e43cecc6b8a5571dcad0b973078cf291 /src/cadet
parent2007200fb5d9b03ff0b1b055c3c7ccc8c9738f34 (diff)
downloadgnunet-c12b21f9592f5f5f4714ba892f4cb334db16afb6.tar.gz
gnunet-c12b21f9592f5f5f4714ba892f4cb334db16afb6.zip
- Check path for NULL, fix #3583
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 451ffe3dd..dc5f2f1e7 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -720,6 +720,9 @@ get_prev_hop (const struct CadetConnection *c)
720{ 720{
721 GNUNET_PEER_Id id; 721 GNUNET_PEER_Id id;
722 722
723 if (NULL == c->path)
724 return NULL;
725
723 LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n", 726 LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n",
724 GCC_2s (c), c->own_pos, c->path->length); 727 GCC_2s (c), c->own_pos, c->path->length);
725 if (0 == c->own_pos || c->path->length < 2) 728 if (0 == c->own_pos || c->path->length < 2)
@@ -746,6 +749,9 @@ get_next_hop (const struct CadetConnection *c)
746{ 749{
747 GNUNET_PEER_Id id; 750 GNUNET_PEER_Id id;
748 751
752 if (NULL == c->path)
753 return NULL;
754
749 LOG (GNUNET_ERROR_TYPE_DEBUG, " get next hop %s [%u/%u]\n", 755 LOG (GNUNET_ERROR_TYPE_DEBUG, " get next hop %s [%u/%u]\n",
750 GCC_2s (c), c->own_pos, c->path->length); 756 GCC_2s (c), c->own_pos, c->path->length);
751 if ((c->path->length - 1) == c->own_pos || c->path->length < 2) 757 if ((c->path->length - 1) == c->own_pos || c->path->length < 2)
@@ -2950,14 +2956,22 @@ void
2950GCC_notify_broken (struct CadetConnection *c, 2956GCC_notify_broken (struct CadetConnection *c,
2951 struct CadetPeer *peer) 2957 struct CadetPeer *peer)
2952{ 2958{
2959 struct CadetPeer *hop;
2953 int fwd; 2960 int fwd;
2954 2961
2955 LOG (GNUNET_ERROR_TYPE_DEBUG, 2962 LOG (GNUNET_ERROR_TYPE_DEBUG,
2956 " notify broken on %s due to %s disconnect\n", 2963 " notify broken on %s due to %s disconnect\n",
2957 GCC_2s (c), GCP_2s (peer)); 2964 GCC_2s (c), GCP_2s (peer));
2958 2965
2959 fwd = peer == get_prev_hop (c); 2966 hop = get_prev_hop (c);
2967 if (NULL == hop)
2968 {
2969 /* Path was NULL, we should have deleted the connection. */
2970 GNUNET_break (0);
2971 return;
2972 }
2960 2973
2974 fwd = (peer == hop);
2961 if (GNUNET_YES == GCC_is_terminal (c, fwd)) 2975 if (GNUNET_YES == GCC_is_terminal (c, fwd))
2962 { 2976 {
2963 /* Local shutdown, no one to notify about this. */ 2977 /* Local shutdown, no one to notify about this. */