From cda24d94fb1be6a2e10c544fcc6f91f9b6f235f9 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sun, 11 Mar 2012 22:19:12 +0000 Subject: [PATCH] Fixed overflow in substitute_index_file() --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 864e76ad..e668d923 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2683,7 +2683,7 @@ static int substitute_index_file(struct mg_connection *conn, char *path, while ((list = next_option(list, &filename_vec, NULL)) != NULL) { // Ignore too long entries that may overflow path buffer - if (filename_vec.len > path_len - n) + if (filename_vec.len > path_len - (n + 2)) continue; // Prepare full path to the index file