svn commit: samba r20361 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_24/source/lib

jra at samba.org jra at samba.org
Wed Dec 27 18:36:01 GMT 2006


Author: jra
Date: 2006-12-27 18:36:00 +0000 (Wed, 27 Dec 2006)
New Revision: 20361

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

Log:
Prevent strnlen_w reading beyond max. Valgrind
found by Volker.
Jeremy

Modified:
   branches/SAMBA_3_0/source/lib/util_unistr.c
   branches/SAMBA_3_0_24/source/lib/util_unistr.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_unistr.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_unistr.c	2006-12-27 18:00:20 UTC (rev 20360)
+++ branches/SAMBA_3_0/source/lib/util_unistr.c	2006-12-27 18:36:00 UTC (rev 20361)
@@ -484,7 +484,7 @@
 	size_t len;
 	smb_ucs2_t c;
 
-	for(len = 0; *(COPY_UCS2_CHAR(&c,src)) && (len < max); src++, len++) {
+	for(len = 0; (len < max) && *(COPY_UCS2_CHAR(&c,src)); src++, len++) {
 		;
 	}
 

Modified: branches/SAMBA_3_0_24/source/lib/util_unistr.c
===================================================================
--- branches/SAMBA_3_0_24/source/lib/util_unistr.c	2006-12-27 18:00:20 UTC (rev 20360)
+++ branches/SAMBA_3_0_24/source/lib/util_unistr.c	2006-12-27 18:36:00 UTC (rev 20361)
@@ -484,7 +484,7 @@
 	size_t len;
 	smb_ucs2_t c;
 
-	for(len = 0; *(COPY_UCS2_CHAR(&c,src)) && (len < max); src++, len++) {
+	for(len = 0; (len < max) && *(COPY_UCS2_CHAR(&c,src)); src++, len++) {
 		;
 	}
 



More information about the samba-cvs mailing list