diff options
author | Simon Rettberg | 2017-04-21 16:31:36 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-21 16:31:36 +0200 |
commit | 57d958c8817fca07c7e2a165a422bb235a361981 (patch) | |
tree | 5d2770e3be032ed23bdadd4d0ae418be2b8a06c0 | |
parent | Update ldap/asn1/... files with current tinyldap (diff) | |
download | ldadp-57d958c8817fca07c7e2a165a422bb235a361981.tar.gz ldadp-57d958c8817fca07c7e2a165a422bb235a361981.tar.xz ldadp-57d958c8817fca07c7e2a165a422bb235a361981.zip |
scan_asn1length: Allow non-minimally encoded values
Needed to handle Windows AD replies, because why adhere to standards
at Microsoft ;)
-rw-r--r-- | scan_asn1length.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scan_asn1length.c b/scan_asn1length.c index 9e20fae..150de94 100644 --- a/scan_asn1length.c +++ b/scan_asn1length.c @@ -14,12 +14,12 @@ size_t scan_asn1length(const char* src,const char* max,size_t* value) { c&=0x7f; if (!c) return 0; /* length 0x80 means indefinite length encoding, not supported here */ l=(unsigned char)src[1]; - if (l==0) return 0; /* not minimally encoded: 0x81 0x00 instead of 0x00 */ + //if (l==0) return 0; /* not minimally encoded: 0x81 0x00 instead of 0x00 XXX: We need to support this for Active Directory support :/ */ if (c>sizeof(l)) return 0; /* too many bytes, does not fit into target integer type */ if (c+1>len) return 0; /* not enough data in input buffer */ for (i=2; i<=c; ++i) l=l*256+(unsigned char)src[i]; - if (l<0x7f) return 0; /* not minimally encoded: 0x81 0x70 instead of 0x70 */ + //if (l<0x7f) return 0; /* not minimally encoded: 0x81 0x70 instead of 0x70 XXX: Same AD issue as above */ } if (l>len-i) return 0; /* if the length would not fit into the buffer, return 0 */ *value=l; |