svn commit: samba r7953 - in trunk/source/libsmb: .
jra at samba.org
jra at samba.org
Mon Jun 27 18:53:36 GMT 2005
Author: jra
Date: 2005-06-27 18:53:36 +0000 (Mon, 27 Jun 2005)
New Revision: 7953
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7953
Log:
Fix from tridge from Samba4 (same code exists here) :
fixed handling of ASN.1 objects bigger than 64k
Jeremy.
Modified:
trunk/source/libsmb/asn1.c
Changeset:
Modified: trunk/source/libsmb/asn1.c
===================================================================
--- trunk/source/libsmb/asn1.c 2005-06-27 18:32:58 UTC (rev 7952)
+++ trunk/source/libsmb/asn1.c 2005-06-27 18:53:36 UTC (rev 7953)
@@ -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