aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-07 10:56:57 -0500
committerJack Lloyd <[email protected]>2016-11-07 10:56:57 -0500
commit7ecb99c6200bc0d2235f38ba582ebd8965789594 (patch)
tree6ef22f6ac6ffcd12e6f7eee21102ff8234be3d3e /src/lib/asn1
parent9faceec939b2a00043720f07f49e9fee22c60984 (diff)
If peek fails, force EOF with a read
DataSource_Stream::peek resets EOF bit after a failed peek Fixes #657 cert_info infinite loop
Diffstat (limited to 'src/lib/asn1')
-rw-r--r--src/lib/asn1/asn1_obj.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/asn1/asn1_obj.cpp b/src/lib/asn1/asn1_obj.cpp
index 20555e3dd..e258cd809 100644
--- a/src/lib/asn1/asn1_obj.cpp
+++ b/src/lib/asn1/asn1_obj.cpp
@@ -56,7 +56,10 @@ bool maybe_BER(DataSource& source)
{
byte first_byte;
if(!source.peek_byte(first_byte))
+ {
+ source.read_byte(first_byte); // force EOF
throw Stream_IO_Error("ASN1::maybe_BER: Source was empty");
+ }
if(first_byte == (SEQUENCE | CONSTRUCTED))
return true;