diff --git a/scan/scan_asn1derlength.c b/scan/scan_asn1derlength.c index a0b02d7..557f555 100644 --- a/scan/scan_asn1derlength.c +++ b/scan/scan_asn1derlength.c @@ -46,7 +46,7 @@ size_t scan_asn1derlengthvalue(const char* src,size_t len,unsigned long long* va size_t scan_asn1derlength(const char* src,size_t len,unsigned long long* value) { unsigned long long l; size_t i=scan_asn1derlengthvalue(src,len,&l); - if (l > len-i) return 0; /* make sure data would fit into buffer */ + if (!i || l > len-i) return 0; /* make sure data would fit into buffer */ *value=l; return i; } diff --git a/scan/scan_varint.c b/scan/scan_varint.c index 8c6a7ff..ec2373e 100644 --- a/scan/scan_varint.c +++ b/scan/scan_varint.c @@ -4,7 +4,6 @@ size_t scan_varint(const char* in,size_t len, unsigned long long* n) { size_t i; unsigned long long l; if (len==0) return 0; - l=0; for (l=0, i=0; i