From 9579203a99a98068dee82c3e1d511dfaf720c040 Mon Sep 17 00:00:00 2001 From: johenning Date: Sat, 26 Aug 2017 15:55:00 +0200 Subject: [PATCH 1/3] Fixed double backslash case If the first two symbols in the path are backslashes, we should not treat them like a single backslash, as one refers to root and the other to a network path. --- rtgui/batchqueue.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index da042347d..03cc9535c 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -743,8 +743,15 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam da.push_back (tok); } - if (origFileName[0] == '/' || origFileName[0] == '\\') { + if (origFileName[0] == '/') { pa.push_back ("/" + da[0]); + } else if (origFileName[0] == '\\') { + if (origFileName[1] == '\\') { + pa.push_back ("\\\\" + da[0]); + } + else { + pa.push_back ("/" + da[0]); + } } else { pa.push_back (da[0]); } From 9e6888070ddb127c2b9534fbc847f87ca832daf2 Mon Sep 17 00:00:00 2001 From: johenning Date: Sat, 26 Aug 2017 16:02:36 +0200 Subject: [PATCH 2/3] Added check to avoid out of bounds access --- rtgui/batchqueue.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 03cc9535c..3a5576987 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -746,7 +746,7 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam if (origFileName[0] == '/') { pa.push_back ("/" + da[0]); } else if (origFileName[0] == '\\') { - if (origFileName[1] == '\\') { + if (origFileName.size() > 1 && origFileName[1] == '\\') { pa.push_back ("\\\\" + da[0]); } else { From 06fd003858e5817798fb667f57e91aa2c9edd7ab Mon Sep 17 00:00:00 2001 From: johenning Date: Sun, 27 Aug 2017 21:27:23 +0200 Subject: [PATCH 3/3] Fixed indentation --- rtgui/batchqueue.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 3a5576987..3d773d874 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -745,13 +745,12 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam if (origFileName[0] == '/') { pa.push_back ("/" + da[0]); - } else if (origFileName[0] == '\\') { - if (origFileName.size() > 1 && origFileName[1] == '\\') { - pa.push_back ("\\\\" + da[0]); - } - else { - pa.push_back ("/" + da[0]); - } + } else if (origFileName[0] == '\\') { + if (origFileName.size() > 1 && origFileName[1] == '\\') { + pa.push_back ("\\\\" + da[0]); + } else { + pa.push_back ("/" + da[0]); + } } else { pa.push_back (da[0]); }