mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-21 11:30:01 +00:00
Detect Window's style slashes in mg_upload file names
This commit is contained in:
1 parent
a856971b6d
commit
4bb9faaf50
1 file changed
+4
-1
+4
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user