From 3bd8c7dec60a26743e889df61c862516eb5bdcc3 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 17 Dec 2012 14:25:31 +0100 Subject: s3-lib: Fix push_ucs2() for-loop. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Günther Deschner --- source3/lib/charcnv.c | 4 ++-- 1 file 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; -- cgit