summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/LAN_discovery.c4
-rw-r--r--core/Messenger.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/core/LAN_discovery.c b/core/LAN_discovery.c
index 55953685..26b3930c 100644
--- a/core/LAN_discovery.c
+++ b/core/LAN_discovery.c
@@ -70,6 +70,10 @@ static uint32_t get_broadcast(void)
70 } 70 }
71 } 71 }
72 close(sock); 72 close(sock);
73 if(sock_holder == NULL) {
74 perror("[!] no broadcast device found");
75 return 0;
76 }
73 77
74 return sock_holder->sin_addr.s_addr; 78 return sock_holder->sin_addr.s_addr;
75} 79}
diff --git a/core/Messenger.c b/core/Messenger.c
index 353ce603..33af599d 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -118,8 +118,8 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length)
118 return FAERR_ALREADYSENT; 118 return FAERR_ALREADYSENT;
119 119
120 uint32_t i; 120 uint32_t i;
121 for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ 121 for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */
122 if(friendlist[i].status == NOFRIEND) { 122 if (friendlist[i].status == NOFRIEND) {
123 DHT_addfriend(client_id); 123 DHT_addfriend(client_id);
124 friendlist[i].status = FRIEND_ADDED; 124 friendlist[i].status = FRIEND_ADDED;
125 friendlist[i].crypt_connection_id = -1; 125 friendlist[i].crypt_connection_id = -1;
@@ -372,7 +372,7 @@ static int send_userstatus(int friendnumber, uint8_t * status, uint16_t length)
372 memcpy(thepacket + 2, status, length); 372 memcpy(thepacket + 2, status, length);
373 thepacket[0] = PACKET_ID_USERSTATUS; 373 thepacket[0] = PACKET_ID_USERSTATUS;
374 thepacket[1] = self_userstatus_kind; 374 thepacket[1] = self_userstatus_kind;
375 int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 1); 375 int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 2);
376 free(thepacket); 376 free(thepacket);
377 return written; 377 return written;
378} 378}