Tried to work on fixing message string bug

master
Aadhavan Srinivasan 2 years ago
parent a565c7ef29
commit 291a727dd3

@ -16,6 +16,7 @@
#define BUFFER_SIZE 10000
#define MAX_CONNECTIONS 100
#define DATA_SIZE 50000
#define MESSAGE_SIZE 50000
User** create_user_list(char* filename);
void sigint_handler(int dummy);
@ -80,6 +81,9 @@ int main() {
}
for (int i=1; i < MAX_CONNECTIONS; i++) {
memset(data,0x00,DATA_SIZE);
if (FD_ISSET(conn_sockets[i],&read_fd_set)) {
while ( strstr(buffer,"END_OF_DATA") == NULL ) {
@ -125,8 +129,10 @@ int main() {
printf("Message intended for %s\n",to_user[i]->username);
}
}
char* message_string = fetch_message_string(data);
char* message_string = malloc(sizeof(char) * MESSAGE_SIZE);
memset(message_string, 0x00, MESSAGE_SIZE);
message_string = fetch_message_string(data);
if (message_string == NULL) {
printf("Invalid message.\n");
return -10;

Loading…
Cancel
Save