summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Instance.cpp
diff options
context:
space:
mode:
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)
{