diff options
author | Jfreegman <Jfreegman@gmail.com> | 2013-08-07 02:34:55 -0400 |
---|---|---|
committer | Jfreegman <Jfreegman@gmail.com> | 2013-08-07 02:34:55 -0400 |
commit | 90524356a79d15353c91ad4125cd7f8d8e7a35d3 (patch) | |
tree | 1b029bddb256ea14cada45752b4c4b8941f5c430 /core | |
parent | d04f2d0e51931db5fbd8c672c44bb1e59fc58b79 (diff) |
Fixed two bugs
Diffstat (limited to 'core')
-rw-r--r-- | core/Messenger.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/Messenger.c b/core/Messenger.c index 5532c9cc..4e994a15 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -116,8 +116,8 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length) | |||
116 | return FAERR_ALREADYSENT; | 116 | return FAERR_ALREADYSENT; |
117 | 117 | ||
118 | uint32_t i; | 118 | uint32_t i; |
119 | for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ | 119 | for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ |
120 | if(friendlist[i].status == NOFRIEND) { | 120 | if (friendlist[i].status == NOFRIEND) { |
121 | DHT_addfriend(client_id); | 121 | DHT_addfriend(client_id); |
122 | friendlist[i].status = FRIEND_ADDED; | 122 | friendlist[i].status = FRIEND_ADDED; |
123 | friendlist[i].crypt_connection_id = -1; | 123 | friendlist[i].crypt_connection_id = -1; |
@@ -141,7 +141,7 @@ int m_addfriend_norequest(uint8_t * client_id) | |||
141 | if (getfriend_id(client_id) != -1) | 141 | if (getfriend_id(client_id) != -1) |
142 | return -1; | 142 | return -1; |
143 | uint32_t i; | 143 | uint32_t i; |
144 | for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ | 144 | for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ |
145 | if(friendlist[i].status == NOFRIEND) { | 145 | if(friendlist[i].status == NOFRIEND) { |
146 | DHT_addfriend(client_id); | 146 | DHT_addfriend(client_id); |
147 | friendlist[i].status = FRIEND_REQUESTED; | 147 | friendlist[i].status = FRIEND_REQUESTED; |