aboutsummaryrefslogtreecommitdiff
path: root/src/clientprotocol.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-07-29 18:37:04 +0100
committerGravatar Sadie Powell2024-07-29 18:37:37 +0100
commit6d956cbed6c30ccfe65d7b86065988d8c603237b (patch)
tree615c1eeef8d1991dd858ab816011e9386573a9cb /src/clientprotocol.cpp
parentAvoid passing malformed socket addresses to sa2cidr. (diff)
Fix some minor bugs in EscapeTag/UnescapeTag.
Diffstat (limited to 'src/clientprotocol.cpp')
-rw-r--r--src/clientprotocol.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/src/clientprotocol.cpp b/src/clientprotocol.cpp
index ac434c855..b7affde4f 100644
--- a/src/clientprotocol.cpp
+++ b/src/clientprotocol.cpp
@@ -80,7 +80,7 @@ std::string ClientProtocol::Message::EscapeTag(const std::string& value)
ret.append("\\s");
break;
case ';':
- ret.append("\\;");
+ ret.append("\\:");
break;
case '\\':
ret.append("\\\\");
@@ -113,36 +113,35 @@ std::string ClientProtocol::Message::UnescapeTag(const std::string& value)
}
it++;
- if (it != value.end())
+ if (it == value.end())
+ break;
+
+ chr = *it;
+ switch (chr)
{
- chr = *it;
- switch (chr)
- {
- case 's':
- ret.push_back(' ');
- break;
- case ':':
- ret.push_back(';');
- break;
- case '\\':
- ret.push_back('\\');
- break;
- case 'n':
- ret.push_back('\n');
- break;
- case 'r':
- ret.push_back('\r');
- break;
- default:
- ret.push_back(chr);
- break;
- }
+ case 's':
+ ret.push_back(' ');
+ break;
+ case ':':
+ ret.push_back(';');
+ break;
+ case '\\':
+ ret.push_back('\\');
+ break;
+ case 'n':
+ ret.push_back('\n');
+ break;
+ case 'r':
+ ret.push_back('\r');
+ break;
+ default:
+ ret.push_back(chr);
+ break;
}
}
return ret;
}
-
const ClientProtocol::SerializedMessage& ClientProtocol::Message::GetSerialized(const SerializedInfo& serializeinfo) const
{
// First check if the serialized line they're asking for is in the cache