diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2016-09-04 15:46:02 +0000 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2016-09-04 15:46:02 +0000 |
commit | dfea9adb31074f1d0d81657c2cad28b5c0bb7fa1 (patch) | |
tree | e473caeb7a0ab08e9c22ec0029d8df6a53f7c46e /src/util/peer.c | |
parent | 330db1cce63a198b86cf0bcaa9949c20d7681d05 (diff) | |
download | gnunet-dfea9adb31074f1d0d81657c2cad28b5c0bb7fa1.tar.gz gnunet-dfea9adb31074f1d0d81657c2cad28b5c0bb7fa1.zip |
Add checks to GNUNET_PEER_resolve2
Diffstat (limited to 'src/util/peer.c')
-rw-r--r-- | src/util/peer.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) | |||
133 | } | 133 | } |
134 | if (0 == ret) | 134 | if (0 == ret) |
135 | { | 135 | { |
136 | memset (&table[0]->id, 0, sizeof (struct GNUNET_PeerIdentity)); | ||
136 | table[0]->pid = 0; | 137 | table[0]->pid = 0; |
137 | table[0]->rc = 1; | 138 | table[0]->rc = 1; |
138 | ret = 1; | 139 | ret = 1; |
@@ -243,6 +244,8 @@ GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid) | |||
243 | const struct GNUNET_PeerIdentity * | 244 | const struct GNUNET_PeerIdentity * |
244 | GNUNET_PEER_resolve2 (GNUNET_PEER_Id id) | 245 | GNUNET_PEER_resolve2 (GNUNET_PEER_Id id) |
245 | { | 246 | { |
247 | GNUNET_assert (id < size); | ||
248 | GNUNET_assert (table[id]->rc > 0); | ||
246 | return &table[id]->id; | 249 | return &table[id]->id; |
247 | } | 250 | } |
248 | 251 | ||