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_ldapmodifyrequest.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_ldapmodifyrequest.c')
-rw-r--r-- | scan_ldapmodifyrequest.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scan_ldapmodifyrequest.c b/scan_ldapmodifyrequest.c index 8a08388..832d629 100644 --- a/scan_ldapmodifyrequest.c +++ b/scan_ldapmodifyrequest.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <byte.h> #include "ldap.h" #if 0 @@ -19,7 +20,7 @@ size_t scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyRequest* m) { size_t res,tmp,oslen; /* outer sequence length */ struct Modification* last=0; - m->m.next=0; + byte_zero(m,sizeof(*m)); if (!(res=scan_ldapstring(src,max,&m->object))) goto error; if (!(tmp=scan_asn1SEQUENCE(src+res,max,&oslen))) goto error; res+=tmp; @@ -27,11 +28,11 @@ size_t scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyReque max=src+res+oslen; if (src+res>=max) goto error; /* need at least one record */ do { - size_t islen; - unsigned long etmp; + size_t islen, etmp; if (last) { struct Modification* cur; if (!(cur=malloc(sizeof(struct Modification)))) goto error; + byte_zero(cur,sizeof(*cur)); last->next=cur; last=cur; } else last=&m->m; @@ -39,7 +40,8 @@ size_t scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyReque if (!(tmp=scan_asn1SEQUENCE(src+res,max,&islen))) goto error; res+=tmp; if (!(tmp=scan_asn1ENUMERATED(src+res,max,&etmp))) goto error; - if (etmp>2) goto error; last->operation=etmp; res+=tmp; + if (etmp>2) goto error; + last->operation=etmp; res+=tmp; { size_t iislen; /* urgh, _three_ levels of indirection */ const char* imax; @@ -60,8 +62,8 @@ size_t scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyReque ilast=&last->vals; while (src+res<iimax) { if (!(*ilast=malloc(sizeof(struct AttributeDescriptionList)))) goto error; + byte_zero(*ilast,sizeof(**ilast)); if (!(tmp=scan_ldapstring(src+res,imax,&(*ilast)->a))) goto error; - (*ilast)->next=0; ilast=&(*ilast)->next; res+=tmp; } |