summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-06-08 13:11:42 -0600
committercflip <cflip@cflip.net>2023-06-08 13:11:42 -0600
commiteb7a9ca573c24f09d3cc2d3485af848c914aedac (patch)
tree6d753b75d453891fe07797d71b4db258ad4d1a39 /file.c
parentc90a2f7a68e3d1054bceed8b67acb7bd0af8d14f (diff)
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.
Diffstat (limited to 'file.c')
-rw-r--r--file.c2
1 files changed, 2 insertions, 0 deletions
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;
}