one of the off-by-one fixes was bad

This commit is contained in:
leitner
2011-11-08 01:40:01 +00:00
parent d184c99cf9
commit 06871c8925
3 changed files with 16 additions and 9 deletions

View File

@@ -173,5 +173,8 @@ asn1oid.o: asn1oid.c asn1.h
ldap_match_sre.o: ldap_match_sre.c ldap.h
privatekey.pem:
openssl genrsa -out $@
windoze:
$(MAKE) DIET= CROSS=i686-mingw32- asn1dump

View File

@@ -26,6 +26,16 @@ struct x509cert {
struct x509signature sig;
};
struct rsaprivatekey {
size_t* modulus,* publicExponent,* privateExponent,* prime1,* prime2,* exponent1,* exponent2,* coefficient;
struct string otherPrimeInfos;
size_t* freewhendone;
};
struct dsaprivatekey {
}
void printasn1(const char* buf,const char* max);
static int findindn(struct string* dn,enum x509_oid id,struct string* dest) {
@@ -113,12 +123,6 @@ parseerror:
return l;
}
struct rsaprivatekey {
size_t* modulus,* publicExponent,* privateExponent,* prime1,* prime2,* exponent1,* exponent2,* coefficient;
struct string otherPrimeInfos;
size_t* freewhendone;
};
size_t scan_rsaprivatekey(const char* cert, size_t l, struct rsaprivatekey* C, char** freewhendone) {
char* c;
size_t maxdigits,ret;

View File

@@ -39,17 +39,17 @@ size_t scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f)
if (tc!=PRIVATE || (tt!=CONSTRUCTED && tag!=7) || tag>9) goto error;
if (!(tmp=scan_asn1length(src+res,max,&len))) goto error;
res+=tmp;
if (src+res+len>=max) goto error;
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;
nmax=src+res+len;
switch ((*f)->type=tag) {
case 0: /* and [0] SET OF Filter, */
case 1: /* or [1] SET OF Filter, */
(*f)->x=0;
while (src+res<max) {
while (src+res<nmax) {
struct Filter* F=(*f)->x;
if (!(tmp=scan_ldapsearchfilter(src+res,nmax,&(*f)->x))) {
if (F) { /* OK, end of sequence */