summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-27 07:02:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:53 -0500
commitd6c1ad5c174f3b914927396cf3ec595543289109 (patch)
treec9537c55751b782566162f2a5d8e1e768572f07d /source4
parent6861c9069a5da5060f8f3d6ff70c24896310c3fc (diff)
downloadsamba-d6c1ad5c174f3b914927396cf3ec595543289109.tar.gz
samba-d6c1ad5c174f3b914927396cf3ec595543289109.tar.bz2
samba-d6c1ad5c174f3b914927396cf3ec595543289109.zip
r7941: fixed handling of ASN.1 objects bigger than 64k
(This used to be commit f88a6018821163a52bdf384142c7d16f5011ab4e)
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/util/asn1.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index 2a4c75d939..6ca2221b1a 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -87,7 +87,16 @@ 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 > 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;