Fix for www file areas

This commit is contained in:
Andrew Pamment 2018-02-20 12:18:22 +10:00
parent 600c5d588f
commit edb7209a9b
2 changed files with 53 additions and 49 deletions

Binary file not shown.

View File

@ -888,10 +888,13 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
free(url_copy); free(url_copy);
if (file_dir != -1 && file_sub != -1 && filen == NULL) { if (file_dir != -1 && file_sub != -1 && filen == NULL) {
if (file_dir >= 0 && file_dir < conf.file_directory_count && file_sub >= 0 && file_sub < conf.file_directories[file_dir]->file_sub_count) {
if (conf.file_directories[file_dir]->display_on_web) { if (conf.file_directories[file_dir]->display_on_web) {
page = www_files_display_listing(file_dir, file_sub); page = www_files_display_listing(file_dir, file_sub);
} }
}
} else if (file_dir != -1 && file_sub != -1 && filen != NULL) { } else if (file_dir != -1 && file_sub != -1 && filen != NULL) {
if (file_dir >= 0 && file_dir < conf.file_directory_count && file_sub >= 0 && file_sub < conf.file_directories[file_dir]->file_sub_count) {
if (conf.file_directories[file_dir]->display_on_web) { if (conf.file_directories[file_dir]->display_on_web) {
// send file // send file
filename = www_files_get_from_area(file_dir, file_sub, filen); filename = www_files_get_from_area(file_dir, file_sub, filen);
@ -946,6 +949,7 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
} }
free(filen); free(filen);
} }
}
if (page == NULL) { if (page == NULL) {
if (www_403(header, footer, connection) != 0) { if (www_403(header, footer, connection) != 0) {
free(header); free(header);