From 3fd4be7cb2744d852cf99e627f7bfea3fd83bd3c Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Mon, 14 Oct 2024 16:37:18 +0200 Subject: libc: Copy string views to preallocated buffers --- userland/httpd/httpd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'userland/httpd/httpd.c') diff --git a/userland/httpd/httpd.c b/userland/httpd/httpd.c index 845355a..aeae6aa 100644 --- a/userland/httpd/httpd.c +++ b/userland/httpd/httpd.c @@ -107,9 +107,11 @@ void parse_incoming_request(struct http_request *request) { return; } - char *p = SV_TO_C(path); - request->file_fd = open(p, O_RDONLY); - free(p); + { + char path_buffer[256]; + sv_to_cstring_buffer(path, path_buffer, 256); + request->file_fd = open(path_buffer, O_RDONLY); + } if (-1 == request->file_fd) { request->status_code = 404; return; -- cgit v1.2.3