summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Instance.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2014-05-21 14:51:45 -0400
committerBernard Normier <bernard@zeroc.com>2014-05-21 14:51:45 -0400
commit178179830adb16adc56388bd66ebf0bc1a7f3fae (patch)
tree784a48e93c383105cc1f54de1af77534ea8fad8a /cpp/src/Ice/Instance.cpp
parentAdded missing .gitignore for C# IceDiscovery replication demo (diff)
downloadice-178179830adb16adc56388bd66ebf0bc1a7f3fae.tar.bz2
ice-178179830adb16adc56388bd66ebf0bc1a7f3fae.tar.xz
ice-178179830adb16adc56388bd66ebf0bc1a7f3fae.zip
Fixed bug ICE-5543: stringToIdentity bug with escaped escapes
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r--cpp/src/Ice/Instance.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index aa9f8247e3b..23b4b9671cb 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -449,12 +449,22 @@ IceInternal::Instance::stringToIdentity(const string& s) const
Identity ident;
//
- // Find unescaped separator.
+ // Find unescaped separator; note that the string may contain an escaped
+ // backslash before the separator.
//
string::size_type slash = string::npos, pos = 0;
while((pos = s.find('/', pos)) != string::npos)
{
- if(pos == 0 || s[pos - 1] != '\\')
+ int escapes = 0;
+ while(static_cast<int>(pos)- escapes > 0 && s[pos - escapes - 1] == '\\')
+ {
+ escapes++;
+ }
+
+ //
+ // We ignore escaped escapes
+ //
+ if(escapes % 2 == 0)
{
if(slash == string::npos)
{