summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-02-23 07:32:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:47 -0500
commit7f9d949bd34cbeaca8452ea08d39c0e4bbd3a669 (patch)
tree5436d221f784c4fb2e33b37b1b4d51b357a18766 /source4
parent5d15ba663a907b0ac0e3c9ae77325256b380937f (diff)
downloadsamba-7f9d949bd34cbeaca8452ea08d39c0e4bbd3a669.tar.gz
samba-7f9d949bd34cbeaca8452ea08d39c0e4bbd3a669.tar.bz2
samba-7f9d949bd34cbeaca8452ea08d39c0e4bbd3a669.zip
r21510: make it possible to push tags with length > 0xFFFFFF
metze (This used to be commit 8e604107da4a8a1bf6ccab45e85e147daab29519)
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/util/asn1.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index b1328344c5..e64ffdf86c 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -89,7 +89,18 @@ BOOL asn1_pop_tag(struct 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 > 0xFFFF) {
+ if (len > 0xFFFFFF) {
+ data->data[nesting->start] = 0x84;
+ if (!asn1_write_uint8(data, 0)) return False;
+ 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+5, data->data+nesting->start+1, len);
+ data->data[nesting->start+1] = (len>>24) & 0xFF;
+ data->data[nesting->start+2] = (len>>16) & 0xFF;
+ data->data[nesting->start+3] = (len>>8) & 0xFF;
+ data->data[nesting->start+4] = len&0xff;
+ } else if (len > 0xFFFF) {
data->data[nesting->start] = 0x83;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;