commit 2d4ed3613cd2d54b81a80a8847d88e8be550b5af
parent 1fc4ddd00a3933cf76c4a2a6d0c6df5abd681356
Author: finwo <finwo@pm.me>
Date: Tue, 24 Oct 2023 20:22:14 +0200
More reasonable sizes for responseline sscanf, using 's' instead of 'c' for statusMessage
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/http-parser.c b/src/http-parser.c
@@ -667,10 +667,10 @@ void http_parser_response_data(struct http_parser_message *response, const struc
*(index) = '\0';
// Read version and status
- response->version = calloc(1, 4);
- response->statusMessage = calloc(1, 8192);
- aStatus = calloc(1, 4);
- x = sscanf(response->body->data, "HTTP/%3s %3s %8191c", response->version, aStatus, response->statusMessage);
+ response->version = calloc(1, 8);
+ response->statusMessage = calloc(1, 16);
+ aStatus = calloc(1, 8);
+ x = sscanf(response->body->data, "HTTP/%7s %7s %15s", response->version, aStatus, response->statusMessage);
if (x != 3) {
printf("x: %d\n", x);
printf("bdy: %s\n", response->body->data);