From 531a1d681451d31f5c87bfe9645eb28ef3a1baea Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Sat, 8 Sep 2018 17:25:33 -0400 Subject: [PATCH] Fix stack freeing error in common --- common/socket_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/socket_helper.c b/common/socket_helper.c index 48cb75e..f9ffa64 100644 --- a/common/socket_helper.c +++ b/common/socket_helper.c @@ -247,7 +247,8 @@ enum socket_read_result get_all_remote_parts(int socket_fd, enum socket_type typ body_result = read_body_by_content_length(socket_fd, net_content_length); } else if (read_info.strategy == STRATEGY_EOF && type == TYPE_SERVER) { // Servers cannot just wait for EOF with a client, so we just skip the action. - body_result = "\0"; + body_result = malloc(1 * sizeof(char)); + *body_result = '\0'; } else { // In all other cases, such as if we have EOF strategy on a client. body_result = read_body_until_eof(socket_fd);