diff options
Diffstat (limited to 'src/lib/asn1/ber_dec.cpp')
-rw-r--r-- | src/lib/asn1/ber_dec.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/asn1/ber_dec.cpp b/src/lib/asn1/ber_dec.cpp index ac676cd08..81c04aa6a 100644 --- a/src/lib/asn1/ber_dec.cpp +++ b/src/lib/asn1/ber_dec.cpp @@ -9,6 +9,7 @@ #include <botan/ber_dec.h> #include <botan/bigint.h> #include <botan/loadstor.h> +#include <botan/internal/safeint.h> namespace Botan { @@ -126,7 +127,9 @@ size_t find_eoc(DataSource* ber) size_t item_size = decode_length(&source, length_size); source.discard_next(item_size); - length += item_size + length_size + tag_size; + length = BOTAN_CHECKED_ADD(length, item_size); + length = BOTAN_CHECKED_ADD(length, tag_size); + length = BOTAN_CHECKED_ADD(length, length_size); if(type_tag == EOC && class_tag == UNIVERSAL) break; |