From eb7a9ca573c24f09d3cc2d3485af848c914aedac Mon Sep 17 00:00:00 2001 From: cflip Date: Thu, 8 Jun 2023 13:11:42 -0600 Subject: Unset QUERY_STRING environment variable after running CGI script This prevents an issue where the previous query string would persist on requests without a query string. --- file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/file.c b/file.c index 7d7abb2..b51a5f8 100644 --- a/file.c +++ b/file.c @@ -112,6 +112,8 @@ int file_read_php(const char *filepath, const char *query_str, int sockfd) while ((bytes_read = fread(buffer, 1, FILE_READBUF_SIZE, fp)) > 0) write(sockfd, buffer, bytes_read); + unsetenv("QUERY_STRING"); + pclose(fp); return 0; } -- cgit v1.2.3