From e332f0f541283f8d28535af9330d279e82281da4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 26 Feb 2017 02:03:37 +0100 Subject: [PATCH] #4801 seems solidly fixed now, don't see how it can happen anymore --- .../gnunet-service-transport_neighbours.c | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index bbda715a2..19f5fd081 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -2136,13 +2136,18 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) { struct NeighbourMapEntry *n; + if (0 == + memcmp (&GST_my_identity, + peer, + sizeof (struct GNUNET_PeerIdentity))) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Cowardly refusing to consider myself my neighbour!\n"); + return NULL; + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating new neighbour entry for `%s'\n", GNUNET_i2s (peer)); - GNUNET_assert (0 != - memcmp (&GST_my_identity, - peer, - sizeof (struct GNUNET_PeerIdentity))); n = GNUNET_new (struct NeighbourMapEntry); n->id = *peer; n->ack_state = ACK_UNDEFINED; @@ -2250,6 +2255,7 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message, { /* This is a new neighbour and set to not connected */ n = setup_neighbour (peer); + GNUNET_assert (NULL != n); } /* Remember this SYN message in neighbour */ @@ -2319,6 +2325,7 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message, /* Get rid of remains and re-try */ free_neighbour (n); n = setup_neighbour (peer); + GNUNET_assert (NULL != n); /* Remember the SYN time stamp for ACK message */ n->ack_state = ACK_SEND_SYN_ACK; n->connect_ack_timestamp = ts; @@ -2496,6 +2503,12 @@ switch_address_bl_check_cont (void *cls, if (NULL == (n = lookup_neighbour (peer))) { n = setup_neighbour (peer); + if (NULL == n) + { + /* not sure how this can happen... */ + GNUNET_break (0); + goto cleanup; + } n->state = GNUNET_TRANSPORT_PS_INIT_ATS; } -- 2.25.1