QUOTE: Kindness is always fashionable.

fix: Added missing HTTP body memory allocation - libhttp - A basic HTTP Framework

libhttp

A basic HTTP Framework
git clone git://192.168.2.2/libhttp
Log | Files | Refs | README

commit cf861bd198b2164266912b600ef16d0eae788020
parent 82a811c9136c0bd5ec78030784d1db3cbe28328f
Author: typable <contact@typable.dev>
Date:   Tue, 28 May 2024 17:07:06 +0200

fix: Added missing HTTP body memory allocation

Diffstat:
Mlibhttp.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/libhttp.c b/libhttp.c @@ -389,7 +389,9 @@ http_request_t http_read_request(conn_t *conn) { char *content_length = http_header_get(&request, "Content-Length"); if (content_length != NULL) { request.body_len = strtol(content_length, NULL, 10); + request.body = malloc(sizeof(char) * (request.body_len + 1)); http_read(conn, request.body, request.body_len); + request.body[request.body_len] = '\0'; } break; }