From 0c6510b0a580af487b939d34369f2d533a9f73f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 19 Mar 2017 22:13:12 -0400 Subject: 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. --- asn.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'asn.cpp') 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; } -- cgit v1.2.1