diff options
author | Jeremy Allison <jra@samba.org> | 2006-09-25 16:19:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:14:43 -0500 |
commit | f1964048a5ce7b71d89953ba77ddeb5f34d91747 (patch) | |
tree | 5c8dd1572df41a47366872a4dbdba3585289995d | |
parent | 2cb15a95161abec710523f5076299bfa1c2bb1c2 (diff) | |
download | samba-f1964048a5ce7b71d89953ba77ddeb5f34d91747.tar.gz samba-f1964048a5ce7b71d89953ba77ddeb5f34d91747.tar.bz2 samba-f1964048a5ce7b71d89953ba77ddeb5f34d91747.zip |
r18897: Fix valgrind bug found by Volker.
Jeremy.
(This used to be commit db458d3e8bdd11812cea34128df6a3c29baa59c3)
-rw-r--r-- | source3/lib/charcnv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index ebc97033ac..3d02988a97 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -1053,7 +1053,11 @@ size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_ 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; |