mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Fixed path traversal in bulk file download via filename sanitization.
This commit is contained in:
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "menu/menu_item_download_files.h"
|
||||
|
||||
#include "base/base_file_utilities.h"
|
||||
#include "core/application.h"
|
||||
#include "core/core_settings.h"
|
||||
#include "core/file_utilities.h"
|
||||
@@ -161,7 +162,9 @@ void AddAction(
|
||||
const auto saveDocuments = [=](const QString &folderPath) {
|
||||
for (const auto &[document, origin] : documents) {
|
||||
if (!folderPath.isEmpty()) {
|
||||
document->save(origin, folderPath + document->filename());
|
||||
const auto name =
|
||||
base::FileNameFromUserString(document->filename());
|
||||
document->save(origin, folderPath + name);
|
||||
} else {
|
||||
DocumentSaveClickHandler::SaveAndTrack(origin, document);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user