aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1/ber_dec.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 16:19:56 +0000
committerlloyd <[email protected]>2010-10-12 16:19:56 +0000
commit4a6fd8c70d40f88c8b51127bfa055b66b18e0f7a (patch)
treed8c5697f8de1fff74c5b813fd83c08d310fa8ac0 /src/asn1/ber_dec.cpp
parentc46a5e8d3dd8f07a92fc90027e6f7f70b989ea47 (diff)
Use size_t in all of math, remove to_u32bit
Diffstat (limited to 'src/asn1/ber_dec.cpp')
-rw-r--r--src/asn1/ber_dec.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/asn1/ber_dec.cpp b/src/asn1/ber_dec.cpp
index 860003440..7f0459e22 100644
--- a/src/asn1/ber_dec.cpp
+++ b/src/asn1/ber_dec.cpp
@@ -388,7 +388,14 @@ BER_Decoder& BER_Decoder::decode(u32bit& out,
{
BigInt integer;
decode(integer, type_tag, class_tag);
- out = integer.to_u32bit();
+
+ if(integer.bits() > 32)
+ throw BER_Decoding_Error("Decoded integer value larger than expected");
+
+ out = 0;
+ for(size_t i = 0; i != 4; ++i)
+ out = (out << 8) | integer.byte_at(3-i);
+
return (*this);
}