From 051be910f3bba003c3d7c1fc5873a183e0269fa0 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 10 Sep 2024 21:18:10 +0900 Subject: [PATCH] Fix potential "strlen(NULL)" --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 1ee9189..4b2f276 100644 --- a/src/main.c +++ b/src/main.c @@ -392,8 +392,8 @@ int main(int argc, char **argv) { } else { const char *response = c_simple_http_response_code_error_to_response( response_code); - size_t response_size = strlen(response); if (response) { + response_size = strlen(response); CHECK_ERROR_WRITE(write(connection_fd, response, response_size)); } else { CHECK_ERROR_WRITE(write(