svn commit: samba r18897 - in branches/SAMBA_3_0/source/lib: .
jra at samba.org
jra at samba.org
Mon Sep 25 16:19:30 GMT 2006
Author: jra
Date: 2006-09-25 16:19:30 +0000 (Mon, 25 Sep 2006)
New Revision: 18897
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18897
Log:
Fix valgrind bug found by Volker.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/charcnv.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/charcnv.c
===================================================================
--- branches/SAMBA_3_0/source/lib/charcnv.c 2006-09-25 14:07:33 UTC (rev 18896)
+++ branches/SAMBA_3_0/source/lib/charcnv.c 2006-09-25 16:19:30 UTC (rev 18897)
@@ -1053,7 +1053,11 @@
if (flags & STR_UPPER) {
smb_ucs2_t *dest_ucs2 = (smb_ucs2_t *)dest;
size_t i;
- for (i = 0; i < (dest_len / 2) && dest_ucs2[i]; i++) {
+
+ /* We check for i < (ret / 2) below as the dest string isn't null
+ terminated if STR_TERMINATE isn't set. */
+
+ for (i = 0; i < (ret / 2) && i < (dest_len / 2) && dest_ucs2[i]; i++) {
smb_ucs2_t v = toupper_w(dest_ucs2[i]);
if (v != dest_ucs2[i]) {
dest_ucs2[i] = v;
More information about the samba-cvs
mailing list