svn commit: samba r7954 - in branches/SAMBA_3_0/source/libsmb: .
jra at samba.org
jra at samba.org
Mon Jun 27 18:53:42 GMT 2005
Author: jra
Date: 2005-06-27 18:53:38 +0000 (Mon, 27 Jun 2005)
New Revision: 7954
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7954
Log:
Fix from tridge from Samba4 (same code exists here) :
fixed handling of ASN.1 objects bigger than 64k
Jeremy.
Modified:
branches/SAMBA_3_0/source/libsmb/asn1.c
Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/asn1.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/asn1.c 2005-06-27 18:53:36 UTC (rev 7953)
+++ branches/SAMBA_3_0/source/libsmb/asn1.c 2005-06-27 18:53:38 UTC (rev 7954)
@@ -86,7 +86,16 @@
/* 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;
More information about the samba-cvs
mailing list