svn commit: samba r5158 - in branches/SAMBA_3_0/source/lib: .

jerry at samba.org jerry at samba.org
Tue Feb 1 18:24:39 GMT 2005


Author: jerry
Date: 2005-02-01 18:24:39 +0000 (Tue, 01 Feb 2005)
New Revision: 5158

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

Log:
BUG 2263: patch from Timur Bakeyev <timur at com.bat.ru> to guard base64_encode_data_blob() against empty blobs
Modified:
   branches/SAMBA_3_0/source/lib/util_str.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_str.c	2005-02-01 18:14:15 UTC (rev 5157)
+++ branches/SAMBA_3_0/source/lib/util_str.c	2005-02-01 18:24:39 UTC (rev 5158)
@@ -2016,11 +2016,17 @@
 {
 	int bits = 0;
 	int char_count = 0;
-	size_t out_cnt = 0;
-	size_t len = data.length;
-	size_t output_len = data.length * 2;
-	char *result = SMB_MALLOC(output_len); /* get us plenty of space */
+	size_t out_cnt, len, output_len;
+	char *result;
 
+        if (!data.length || !data.data)
+		return NULL;
+
+	out_cnt = 0;
+	len = data.length;
+	output_len = data.length * 2;
+	result = SMB_MALLOC(output_len); /* get us plenty of space */
+
 	while (len-- && out_cnt < (data.length * 2) - 5) {
 		int c = (unsigned char) *(data.data++);
 		bits += c;



More information about the samba-cvs mailing list