summaryrefslogtreecommitdiff
path: root/asn.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-03-19 22:13:12 -0400
committerJeffrey Walton <noloader@gmail.com>2017-03-19 22:13:12 -0400
commit0c6510b0a580af487b939d34369f2d533a9f73f7 (patch)
treeaade617e9fa714c1700d4bb83f8ac93bec660de9 /asn.cpp
parente7fa88083c5c14b5da9a2174a791048df27959d5 (diff)
downloadcryptopp-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.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/asn.cpp b/asn.cpp
index 2502597f..fb1bff0d 100644
--- a/asn.cpp
+++ b/asn.cpp
@@ -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;
}