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.
This commit is contained in:
parent
72b309bbe4
commit
d2013a6337
2 changed files with 2 additions and 1 deletions
1
LICENSE
1
LICENSE
|
@ -9,6 +9,7 @@ Copyright 2017-2018 Hiltjo Posthuma <hiltjo@codemadness.org>
|
|||
Copyright 2017-2018 Quentin Rameau <quinq@fifth.space>
|
||||
Copyright 2018 Josuah Demangeon <mail@josuah.net>
|
||||
Copyright 2018 Dominik Schmidt <domischmidt@swissonline.ch>
|
||||
Copyright 2018 Aaron Burrow <burrows@charstarstar.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
2
http.c
2
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] != '/') {
|
||||
|
|
Loading…
Reference in a new issue