diff options
author | irungentoo <irungentoo@gmail.com> | 2013-10-05 09:09:28 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-10-05 09:09:28 -0400 |
commit | b0f9e6db6fbeea9dc3bcf86613639d457e440300 (patch) | |
tree | 383e8b087b7e54bc19def82dbb4f1ce8d1f56d39 /toxcore | |
parent | edf799133c2e75f697c9e2e4bee9e14bb4532eb3 (diff) |
m_addfriend_norequest now prevents you from adding your own id as friend.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/Messenger.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 5ed94bb7..32243053 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -220,6 +220,9 @@ int m_addfriend_norequest(Messenger *m, uint8_t *client_id) | |||
220 | if (realloc_friendlist(m, m->numfriends + 1) != 0) | 220 | if (realloc_friendlist(m, m->numfriends + 1) != 0) |
221 | return FAERR_NOMEM; | 221 | return FAERR_NOMEM; |
222 | 222 | ||
223 | if (memcmp(client_id, m->net_crypto->self_public_key, crypto_box_PUBLICKEYBYTES) == 0) | ||
224 | return FAERR_OWNKEY; | ||
225 | |||
223 | memset(&(m->friendlist[m->numfriends]), 0, sizeof(Friend)); | 226 | memset(&(m->friendlist[m->numfriends]), 0, sizeof(Friend)); |
224 | 227 | ||
225 | uint32_t i; | 228 | uint32_t i; |