summaryrefslogtreecommitdiff
path: root/download.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2023-08-29 18:13:30 +0200
committerVincent Douillet <vincent@vdouillet.fr>2023-08-29 18:13:30 +0200
commit2acc8db2762b98eb061241109877527d58a560bc (patch)
tree4f71b3bc0f934b76f839a5ee3640c91b972c1912 /download.c
parent26a77087027327d72d7229866a1ce12ad11a4d63 (diff)
use PATH_MAX
Diffstat (limited to 'download.c')
-rw-r--r--download.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/download.c b/download.c
index ce22ea7..8512405 100644
--- a/download.c
+++ b/download.c
@@ -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 */