add no length check version of sequence parser (so you can tell how

large the incoming message is to allocate buffer sizes)
This commit is contained in:
leitner
2023-01-18 12:20:20 +00:00
parent 187eda5860
commit b865407aee

View File

@@ -0,0 +1,16 @@
#include "asn1.h"
size_t scan_asn1SEQUENCE_nolengthcheck(const char* src,const char* max,size_t* len) {
size_t res,tmp;
unsigned long tag;
enum asn1_tagclass tc;
enum asn1_tagtype tt;
if (!(res=scan_asn1tag(src,max,&tc,&tt,&tag))) return 0;
if (!(tmp=scan_asn1length_nolengthcheck(src+res,max,len))) return 0;
res+=tmp;
if (tc==UNIVERSAL && tt==CONSTRUCTED && tag==SEQUENCE_OF)
return res;
return 0;
}