diff options
author | Andreas Schneider <asn@samba.org> | 2012-12-17 14:25:31 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2012-12-21 13:56:00 +0100 |
commit | 3bd8c7dec60a26743e889df61c862516eb5bdcc3 (patch) | |
tree | 04bfe7cb87e52fefd155d3524e41f309bc3b0401 /source3 | |
parent | 7f8c8d80ef6553dc28f0bf6d9aa7a2c46ab55529 (diff) | |
download | samba-3bd8c7dec60a26743e889df61c862516eb5bdcc3.tar.gz samba-3bd8c7dec60a26743e889df61c862516eb5bdcc3.tar.bz2 samba-3bd8c7dec60a26743e889df61c862516eb5bdcc3.zip |
s3-lib: Fix push_ucs2() for-loop.
ret is a bool and size is what we are looking for here, else the
statement can never be true.
Jeremy please check!
Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/charcnv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 1fa2c5c8cf..407a2091f9 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -286,10 +286,10 @@ static size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_ smb_ucs2_t *dest_ucs2 = (smb_ucs2_t *)dest; size_t i; - /* We check for i < (ret / 2) below as the dest string isn't null + /* We check for i < (size / 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++) { + for (i = 0; i < (size / 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; |