diff options
author | Jose <jose@zeroc.com> | 2017-01-02 18:06:44 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-01-02 18:06:44 +0100 |
commit | 2df05d130ae51a65f51c593800ad722d533f5df3 (patch) | |
tree | 1c4c0c03245a69cdefb949a0060e5642e00aaeed /cpp/src/Ice/OpaqueEndpointI.cpp | |
parent | Update VisualStdio Ice project filters (diff) | |
download | ice-2df05d130ae51a65f51c593800ad722d533f5df3.tar.bz2 ice-2df05d130ae51a65f51c593800ad722d533f5df3.tar.xz ice-2df05d130ae51a65f51c593800ad722d533f5df3.zip |
Fixed (ICE-7477) - Use native Base64 encode/decode
Diffstat (limited to 'cpp/src/Ice/OpaqueEndpointI.cpp')
-rw-r--r-- | cpp/src/Ice/OpaqueEndpointI.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp index 2be3b400dcb..3d63538ec56 100644 --- a/cpp/src/Ice/OpaqueEndpointI.cpp +++ b/cpp/src/Ice/OpaqueEndpointI.cpp @@ -377,19 +377,17 @@ IceInternal::OpaqueEndpointI::checkOption(const string& option, const string& ar ex.str = "no argument provided for -v option in endpoint " + endpoint; throw ex; } - for(string::size_type i = 0; i < argument.size(); ++i) + + try + { + const_cast<vector<Byte>&>(_rawBytes) = Base64::decode(argument); + } + catch(const IceUtil::IllegalArgumentException& ex) { - if(!Base64::isBase64(argument[i])) - { - EndpointParseException ex(__FILE__, __LINE__); - ostringstream ostr; - ostr << "invalid base64 character `" << argument[i] << "' (ordinal " << static_cast<int>(argument[i]) - << ") in endpoint " << endpoint; - ex.str = ostr.str(); - throw ex; - } + ostringstream os; + os << "Invalid Base64 input in opaque endpoint `" << endpoint << "'\n" << ex; + throw EndpointParseException(__FILE__, __LINE__, os.str()); } - const_cast<vector<Byte>&>(_rawBytes) = Base64::decode(argument); return true; } |