git.samba.org
/
ira
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cff7507
)
r7941: fixed handling of ASN.1 objects bigger than 64k
author
Andrew Tridgell
<tridge@samba.org>
Mon, 27 Jun 2005 07:02:39 +0000
(07:02 +0000)
committer
Gerald (Jerry) Carter
<jerry@samba.org>
Wed, 10 Oct 2007 18:18:53 +0000
(13:18 -0500)
source/libcli/util/asn1.c
patch
|
blob
|
history
diff --git
a/source/libcli/util/asn1.c
b/source/libcli/util/asn1.c
index 2a4c75d9394aaff469bdc64d46856aacbed24ed4..6ca2221b1a9417b714ad9da5daf627b04df8adb0 100644
(file)
--- a/
source/libcli/util/asn1.c
+++ b/
source/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 */
/* 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;
data->data[nesting->start] = 0x82;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;