summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-07-12 18:47:03 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-07-12 18:47:03 (GMT)
commit63b311c1bb60469eb5e2ccd2107739e11b189a15 (patch)
tree870057043f88e91b71b961a821a4dace859fc839 /Swiften/IDN
parentc6819a5fd632d03cfe72a58922054765c7383aa6 (diff)
parent08536b4ed31c30a25a343c3c2619676e67a0c692 (diff)
downloadswift-63b311c1bb60469eb5e2ccd2107739e11b189a15.zip
swift-63b311c1bb60469eb5e2ccd2107739e11b189a15.tar.bz2
Merge branch 'swift-1.x'
* swift-1.x: Fixed bug with illegal resource in JID resulting in empty resource. Updated the german translation Conflicts: Swiften/IDN/StringPrep.cpp Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
Diffstat (limited to 'Swiften/IDN')
-rw-r--r--Swiften/IDN/StringPrep.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Swiften/IDN/StringPrep.cpp b/Swiften/IDN/StringPrep.cpp
index 140e130..db09523 100644
--- a/Swiften/IDN/StringPrep.cpp
+++ b/Swiften/IDN/StringPrep.cpp
@@ -43,11 +43,19 @@ using namespace Swift;
namespace Swift {
std::string StringPrep::getPrepared(const std::string& s, Profile profile) {
- return std::string(vecptr(getStringPrepared< std::string, std::vector<char> >(s, profile)));
+ std::vector<char> preparedData = getStringPrepared< std::string, std::vector<char> >(s, profile);
+ if (preparedData.empty()) {
+ throw std::exception();
+ }
+ return std::string(vecptr(preparedData));
}
SafeByteArray StringPrep::getPrepared(const SafeByteArray& s, Profile profile) {
- return createSafeByteArray(reinterpret_cast<const char*>(vecptr(getStringPrepared<SafeByteArray, std::vector<char, SafeAllocator<char> > >(s, profile))));
+ std::vector<char, SafeAllocator<char> > preparedData = getStringPrepared<SafeByteArray, std::vector<char, SafeAllocator<char> > >(s, profile);
+ if (preparedData.empty()) {
+ throw std::exception();
+ }
+ return createSafeByteArray(reinterpret_cast<const char*>(vecptr(preparedData)));
}
}