make sure client_message is null terminated, prevents a buffer overflow
This commit is contained in:
parent
876a56e216
commit
1d84d1eb62
1 changed files with 1 additions and 0 deletions
1
fbflut.c
1
fbflut.c
|
@ -27,6 +27,7 @@ void *handle_connection(void *socket_desc) {
|
|||
char *message, *command, client_message[36];
|
||||
|
||||
while ((read_size = recv(sock, client_message, 36, MSG_PEEK)) > 0) {
|
||||
client_message[read_size] = '\0';
|
||||
read_to = (char *)strchrnul(client_message, '\n')-client_message;
|
||||
memset(client_message, 0, 36);
|
||||
read_size = recv(sock, client_message, read_to+1, 0);
|
||||
|
|
Loading…
Reference in a new issue