From: David Barksdale Date: Sun, 4 Sep 2016 15:46:02 +0000 (+0000) Subject: Add checks to GNUNET_PEER_resolve2 X-Git-Tag: initial-import-from-subversion-38251~295 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dfea9adb31074f1d0d81657c2cad28b5c0bb7fa1;p=oweals%2Fgnunet.git Add checks to GNUNET_PEER_resolve2 --- diff --git a/src/util/peer.c b/src/util/peer.c index 6d7a3a654..5d54a4301 100644 --- a/src/util/peer.c +++ b/src/util/peer.c @@ -133,6 +133,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid) } if (0 == ret) { + memset (&table[0]->id, 0, sizeof (struct GNUNET_PeerIdentity)); table[0]->pid = 0; table[0]->rc = 1; ret = 1; @@ -243,6 +244,8 @@ GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid) const struct GNUNET_PeerIdentity * GNUNET_PEER_resolve2 (GNUNET_PEER_Id id) { + GNUNET_assert (id < size); + GNUNET_assert (table[id]->rc > 0); return &table[id]->id; }