Fix one byte NULL stack overflow - quark - quark web server | |
git clone git://git.suckless.org/quark | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit d2013a6337972c62a71f01324e87af0e55579245 | |
parent 72b309bbe40444add563cdc37c0aa31386a4630d | |
Author: Aaron Burrow <[email protected]> | |
Date: Mon, 16 Jul 2018 22:46:09 +0200 | |
Fix one byte NULL stack overflow | |
Don't append a forward slash if the length of a folder is PATH_MAX-1. This can | |
happen if HEADER_MAX is larger than PATH_MAX or if the `-m` option is used to | |
increase the path length. | |
Diffstat: | |
M LICENSE | 1 + | |
M http.c | 2 +- | |
2 files changed, 2 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/LICENSE b/LICENSE | |
@@ -9,6 +9,7 @@ Copyright 2017-2018 Hiltjo Posthuma <[email protected]> | |
Copyright 2017-2018 Quentin Rameau <[email protected]> | |
Copyright 2018 Josuah Demangeon <[email protected]> | |
Copyright 2018 Dominik Schmidt <[email protected]> | |
+Copyright 2018 Aaron Burrow <[email protected]> | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted, provided that the above | |
diff --git a/http.c b/http.c | |
@@ -430,7 +430,7 @@ http_send_response(int fd, struct request *r) | |
if (S_ISDIR(st.st_mode)) { | |
/* add / to target if not present */ | |
len = strlen(realtarget); | |
- if (len == PATH_MAX - 2) { | |
+ if (len >= PATH_MAX - 2) { | |
return http_send_status(fd, S_REQUEST_TOO_LARGE); | |
} | |
if (len && realtarget[len - 1] != '/') { |