summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-06-27 18:53:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:04 -0500
commit600935af498739db32874e57e763e9ce056f1bf5 (patch)
tree489d45591215a50149dd1ded9ea0554f435a33c6
parente55d945ff1b4fb95f19527b1fa41af374b501488 (diff)
downloadsamba-600935af498739db32874e57e763e9ce056f1bf5.tar.gz
samba-600935af498739db32874e57e763e9ce056f1bf5.tar.bz2
samba-600935af498739db32874e57e763e9ce056f1bf5.zip
r7954: Fix from tridge from Samba4 (same code exists here) :
fixed handling of ASN.1 objects bigger than 64k Jeremy. (This used to be commit 0da60e9954b84bac29bb219803f6175b7a30b591)
-rw-r--r--source3/libsmb/asn1.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/libsmb/asn1.c b/source3/libsmb/asn1.c
index 6db12fc612..0999840794 100644
--- a/source3/libsmb/asn1.c
+++ b/source3/libsmb/asn1.c
@@ -86,7 +86,16 @@ BOOL asn1_pop_tag(ASN1_DATA *data)
/* yes, this is ugly. We don't know in advance how many bytes the length
of a tag will take, so we assumed 1 byte. If we were wrong then we
need to correct our mistake */
- if (len > 255) {
+ if (len > 0xFFFF) {
+ data->data[nesting->start] = 0x83;
+ if (!asn1_write_uint8(data, 0)) return False;
+ if (!asn1_write_uint8(data, 0)) return False;
+ if (!asn1_write_uint8(data, 0)) return False;
+ memmove(data->data+nesting->start+4, data->data+nesting->start+1, len);
+ data->data[nesting->start+1] = (len>>16) & 0xFF;
+ data->data[nesting->start+2] = (len>>8) & 0xFF;
+ data->data[nesting->start+3] = len&0xff;
+ } else if (len > 255) {
data->data[nesting->start] = 0x82;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;