fixed why2_read_socket allocation sizes
This commit is contained in:
parent
03418e7494
commit
924c840e0d
@ -168,7 +168,7 @@ char *why2_read_socket(int socket)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned short content_size = 0;
|
unsigned short content_size = 0;
|
||||||
char *content_buffer = why2_calloc(2, sizeof(char));
|
char *content_buffer = why2_calloc(3, sizeof(char));
|
||||||
|
|
||||||
//GET LENGTH
|
//GET LENGTH
|
||||||
if (recv(socket, content_buffer, 2, 0) != 2) return NULL;
|
if (recv(socket, content_buffer, 2, 0) != 2) return NULL;
|
||||||
@ -178,7 +178,7 @@ char *why2_read_socket(int socket)
|
|||||||
why2_deallocate(content_buffer);
|
why2_deallocate(content_buffer);
|
||||||
|
|
||||||
//ALLOCATE
|
//ALLOCATE
|
||||||
content_buffer = why2_calloc(content_size + 1, sizeof(char));
|
content_buffer = why2_calloc(content_size + 3, sizeof(char));
|
||||||
|
|
||||||
//READ FINAL MESSAGE
|
//READ FINAL MESSAGE
|
||||||
if (recv(socket, content_buffer, content_size, 0) != content_size) fprintf(stderr, "Socket probably read wrongly!\n");
|
if (recv(socket, content_buffer, content_size, 0) != content_size) fprintf(stderr, "Socket probably read wrongly!\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user