svn commit: samba r14902 - in branches/SAMBA_4_0/source/lib/charset: .

tridge at samba.org tridge at samba.org
Tue Apr 4 02:01:37 GMT 2006


Author: tridge
Date: 2006-04-04 02:01:35 +0000 (Tue, 04 Apr 2006)
New Revision: 14902

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

Log:

change charcnv code to fail the conversion when it hits bad
characters, rather than silently truncating the string. This makes the
code much omre conservative, making it easier to test. It might mean
users hit problems initially, but at least we'll hear about them, and
thus can fix them.

Modified:
   branches/SAMBA_4_0/source/lib/charset/charcnv.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/charset/charcnv.c
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/charcnv.c	2006-04-04 01:22:38 UTC (rev 14901)
+++ branches/SAMBA_4_0/source/lib/charset/charcnv.c	2006-04-04 02:01:35 UTC (rev 14902)
@@ -168,7 +168,7 @@
 		switch(errno) {
 			case EINVAL:
 				reason="Incomplete multibyte sequence";
-				break;
+				return -1;
 			case E2BIG:
 				reason="No more room"; 
 				if (from == CH_UNIX) {
@@ -181,10 +181,10 @@
 						 charset_name(from), charset_name(to),
 						 (int)srclen, (int)destlen));
 				}
-		               break;
+			       return -1;
 			case EILSEQ:
 			       reason="Illegal multibyte sequence";
-			       break;
+			       return -1;
 		}
 		/* smb_panic(reason); */
 	}



More information about the samba-cvs mailing list