diff options
author | Simon Rettberg | 2017-04-21 16:31:06 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-21 16:31:06 +0200 |
commit | b61176f17b59a94750dff1f959231dadc4e6078a (patch) | |
tree | 88ee419323ba332a1dd06c5aa801c87f59b36bb3 /scan_ldapsearchfilter.c | |
parent | ldadp.h: Add missing SearchRequestReference opcode (diff) | |
download | ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.tar.gz ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.tar.xz ldadp-b61176f17b59a94750dff1f959231dadc4e6078a.zip |
Update ldap/asn1/... files with current tinyldap
Diffstat (limited to 'scan_ldapsearchfilter.c')
-rw-r--r-- | scan_ldapsearchfilter.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/scan_ldapsearchfilter.c b/scan_ldapsearchfilter.c index 3c58df5..1a08141 100644 --- a/scan_ldapsearchfilter.c +++ b/scan_ldapsearchfilter.c @@ -32,8 +32,7 @@ size_t scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) { enum asn1_tagclass tc; enum asn1_tagtype tt; - size_t len,res,tmp; - unsigned long tag; + size_t tag,len,res,tmp; const char* nmax; *f=0; if (!(res=scan_asn1tag(src,max,&tc,&tt,&tag))) goto error; @@ -42,10 +41,7 @@ size_t scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) res+=tmp; nmax=src+res+len; if (nmax>max) goto error; - if (!(*f=malloc(sizeof(struct Filter)))) goto error; - (*f)->next=0; - (*f)->x=0; - (*f)->substrings=0; + if (!(*f=calloc(1,sizeof(struct Filter)))) goto error; switch ((*f)->type=tag) { case 0: /* and [0] SET OF Filter, */ case 1: /* or [1] SET OF Filter, */ @@ -85,13 +81,12 @@ size_t scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) res+=tmp; if (src+res+len2!=nmax) goto error; while (src+res<nmax) { - struct Substring* s=malloc(sizeof(struct Substring)); + struct Substring* s=calloc(1,sizeof(struct Substring)); unsigned long x; enum asn1_tagtype tt; enum asn1_tagclass tc; if (!s) goto error; - if (!(tmp=scan_asn1string(src+res,nmax,&tc,&tt,&x,&s->s.s,&s->s.l))) { free(s); goto error; } - if (x>2) goto error; + if (!(tmp=scan_asn1string(src+res,nmax,&tc,&tt,&x,&s->s.s,&s->s.l)) || x>2) { free(s); goto error; } s->substrtype=x; res+=tmp; s->next=(*f)->substrings; |