summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2024-03-31 17:52:28 +0200
committerAlbert Astals Cid <aacid@kde.org>2024-04-03 18:44:01 +0000
commit7f62fdb0c120f5e9d4add5b8a985e145f2b7371d (patch)
tree3971a04203158235211fe272fb4870fc3e1e9cf9
parentb4ac7d9af7cb5edfcfcbda035ed8b8c218ba8564 (diff)
pdfdetach: find -> starts_with
-rw-r--r--utils/pdfdetach.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc
index 2bd60b87..fc3e9c75 100644
--- a/utils/pdfdetach.cc
+++ b/utils/pdfdetach.cc
@@ -233,7 +233,7 @@ int main(int argc, char *argv[])
std::filesystem::path filePath = basePath;
filePath = filePath.append(filename).lexically_normal();
- if (filePath.generic_string().find(basePath.generic_string()) != 0) {
+ if (!filePath.generic_string().starts_with(basePath.generic_string())) {
error(errIO, -1, "Preventing directory traversal");
return 3;
}
@@ -296,7 +296,7 @@ int main(int argc, char *argv[])
std::filesystem::path filePath = basePath;
filePath = filePath.append(targetPath).lexically_normal();
- if (filePath.generic_string().find(basePath.generic_string()) != 0) {
+ if (!filePath.generic_string().starts_with(basePath.generic_string())) {
error(errIO, -1, "Preventing directory traversal");
return 3;
}