aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-06-27 17:49:24 +0000
committerlloyd <[email protected]>2013-06-27 17:49:24 +0000
commit88a8df2808f8f086930b6fc6bca1849a330befbd (patch)
treebe3a5c7fe588902b65a54d06b040476f74a6bd9b
parentfbcff1ecf40ad4014f474e1dc9691c9895137d52 (diff)
Check for overflow when decoding OIDs
-rw-r--r--src/asn1/asn1_oid.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/asn1/asn1_oid.cpp b/src/asn1/asn1_oid.cpp
index 009b1c2fc..bbbfd822b 100644
--- a/src/asn1/asn1_oid.cpp
+++ b/src/asn1/asn1_oid.cpp
@@ -173,7 +173,12 @@ void OID::decode_from(BER_Decoder& decoder)
while(i != obj.value.size() - 1)
{
++i;
+
+ if(component >> (32-7))
+ throw Decoding_Error("OID component overflow");
+
component = (component << 7) + (obj.value[i] & 0x7F);
+
if(!(obj.value[i] & 0x80))
break;
}