Commit 4bb9faaf authored by Katerina Blinova's avatar Katerina Blinova

Detect Window's style slashes in mg_upload file names

parent a856971b
......@@ -4227,8 +4227,11 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir) {
fp = NULL;
// Construct destination file name. Do not allow paths to have slashes.
if ((s = strrchr(fname, '/')) == NULL) {
s = fname;
if ((s = strrchr(fname, '\\')) == NULL) {
s = fname;
}
}
// Open file in binary mode. TODO: set an exclusive lock.
snprintf(path, sizeof(path), "%s/%s", destination_dir, s);
if ((fp = fopen(path, "wb")) == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment