svn commit: samba r7941 - in branches/SAMBA_4_0/source/libcli/util: .

tridge at samba.org tridge at samba.org
Mon Jun 27 07:02:40 GMT 2005


Author: tridge
Date: 2005-06-27 07:02:39 +0000 (Mon, 27 Jun 2005)
New Revision: 7941

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7941

Log:
fixed handling of ASN.1 objects bigger than 64k



Modified:
   branches/SAMBA_4_0/source/libcli/util/asn1.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/util/asn1.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/util/asn1.c	2005-06-27 05:46:45 UTC (rev 7940)
+++ branches/SAMBA_4_0/source/libcli/util/asn1.c	2005-06-27 07:02:39 UTC (rev 7941)
@@ -87,7 +87,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