mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-04 21:58:22 +00:00
Fixed bug in verify_document_root()
This commit is contained in:
1 parent
3583e83a3f
commit
27ccf416c1
1 file changed
+3
-2
@@ -131,12 +131,13 @@ static void verify_document_root(const char *root) {
|
|||||||
|
|
||||||
path = root;
|
path = root;
|
||||||
if ((p = strchr(root, ',')) != NULL && (size_t) (p - root) < sizeof(buf)) {
|
if ((p = strchr(root, ',')) != NULL && (size_t) (p - root) < sizeof(buf)) {
|
||||||
strncpy(buf, root, p - root);
|
memcpy(buf, root, p - root);
|
||||||
|
buf[p - root] = '\0';
|
||||||
path = buf;
|
path = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat(path, &st) != 0 || !S_ISDIR(st.st_mode)) {
|
if (stat(path, &st) != 0 || !S_ISDIR(st.st_mode)) {
|
||||||
die("Invalid root directory: \"%s\"", root);
|
die("Invalid root directory: [%s]: %s", root, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user