diff options
Diffstat (limited to 'download.c')
-rw-r--r-- | download.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -32,6 +32,7 @@ #include <sys/stat.h> #include <fcntl.h> +#include <limits.h> #include <unistd.h> #include "cgi.h" @@ -46,7 +47,7 @@ download(struct kreq * r) void *buffer; struct stat st; int st_ret, fd; - char file_path[URL_LENGTH_MAX]; + char file_path[PATH_MAX]; size_t path_size; /* check that the requested URL can be safely processed */ @@ -54,11 +55,11 @@ download(struct kreq * r) http_exit(r, KHTTP_400, "download: Invalid request path"); /* build requested file path */ - path_size = url_build(file_path, URL_LENGTH_MAX, DATA_DIR, "File.txt", + path_size = url_build(file_path, PATH_MAX, DATA_DIR, "File.txt", NULL); if (path_size == 0) http_exit(r, KHTTP_404, "download: Unable to build file path"); - if (path_size >= URL_LENGTH_MAX) + if (path_size >= PATH_MAX) http_exit(r, KHTTP_414, NULL); /* memory map the file */ |