diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-03-19 22:13:12 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-03-19 22:13:12 -0400 |
commit | 0c6510b0a580af487b939d34369f2d533a9f73f7 (patch) | |
tree | aade617e9fa714c1700d4bb83f8ac93bec660de9 /asn.cpp | |
parent | e7fa88083c5c14b5da9a2174a791048df27959d5 (diff) | |
download | cryptopp-git-0c6510b0a580af487b939d34369f2d533a9f73f7.tar.gz |
Guard string assignment
Visual Studio 2005 fired an assert on the negative self tests because the SecByteBlock was 0-sized and returned a null pointer.
Diffstat (limited to 'asn.cpp')
-rw-r--r-- | asn.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -171,7 +171,10 @@ size_t BERDecodeTextString(BufferedTransformation &bt, std::string &str, byte as SecByteBlock temp(bc);
if (bc != bt.Get(temp, bc))
BERDecodeError();
- str.assign((char *)temp.begin(), bc);
+ if (bc)
+ str.assign((char *)temp.begin(), bc);
+ else
+ str.clear();
return bc;
}
|