diff --git a/scan/scan_asn1derlength.c b/scan/scan_asn1derlength.c index 7d2ee91..60c604a 100644 --- a/scan/scan_asn1derlength.c +++ b/scan/scan_asn1derlength.c @@ -2,7 +2,7 @@ size_t scan_asn1derlengthvalue(const char* src,size_t len,unsigned long long* value) { if (len==0 || len>=-(uintptr_t)src) return 0; - unsigned char i,c=*src; + unsigned int i,c=*src; unsigned long long l; if ((c&0x80)==0) { *value=c&0x7f; diff --git a/scan/scan_asn1dertag.c b/scan/scan_asn1dertag.c index 17b6044..7c5e7c1 100644 --- a/scan/scan_asn1dertag.c +++ b/scan/scan_asn1dertag.c @@ -2,14 +2,30 @@ size_t scan_asn1dertag(const char* src,size_t len,unsigned long long* length) { size_t n; - unsigned long long l=0; - for (n=0; n>=1; + } + bits=sizeof(l)*8-bits; + } + for (n=1; n