commit 2f3fe3f930f2c6088ba2d151943afbc4fbc086ea
parent 8bf733ee62bba44c51e1d26d79a6e44c66ba15c2
Author: Bart Polot <bart@net.in.tum.de>
Date: Fri, 5 Sep 2014 16:54:38 +0000
- check path length, simplify error conditions
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
@@ -1858,13 +1858,8 @@ GCP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path,
LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n",
path->length, GCP_2s (peer));
- if ((NULL == peer) || (NULL == path))
- {
- GNUNET_break (0);
- path_destroy (path);
- return NULL;
- }
- if (path->peers[path->length - 1] != peer->id)
+ if (NULL == peer || NULL == path
+ || path->peers[path->length - 1] != peer->id)
{
GNUNET_break (0);
path_destroy (path);
@@ -2010,7 +2005,8 @@ GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path)
{
next = iter->next;
if (0 == memcmp (path->peers, iter->peers,
- sizeof (GNUNET_PEER_Id) * path->length))
+ sizeof (GNUNET_PEER_Id) * path->length)
+ && iter->length == path->length)
{
GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, iter);
if (iter != path)