From 228dd73cae7ee6181c01f0aca87830afa8bf19d5 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Fri, 6 Oct 2023 10:54:57 +1300 Subject: [PATCH] util:charset: Remove unreachable code (CID 1272948) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Suppose that ‘slen’ is equal to (size_t)-1. A few lines up, we had: if (lastp != 0) goto slow_path; Therefore, ‘lastp’ must evaluate to false. Now suppose that ‘slen’ is not equal to (size_t)-1. In that case, we would have executed: if (slen != 0) goto slow_path; Therefore, ‘slen’ must evaluate to false. Consequently, this code can be seen to be unreachable. Signed-off-by: Joseph Sutton Reviewed-by: Douglas Bagnall --- lib/util/charset/convert_string.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c index 859b002ecbc..b15273ce2bb 100644 --- a/lib/util/charset/convert_string.c +++ b/lib/util/charset/convert_string.c @@ -210,15 +210,6 @@ bool convert_string_error_handle(struct smb_iconv_handle *ic, } *converted_size = retval; - - if (!dlen) { - /* Even if we fast path we should note if we ran out of room. */ - if (((slen != (size_t)-1) && slen) || - ((slen == (size_t)-1) && lastp)) { - errno = E2BIG; - return false; - } - } return true; slow_path: -- 2.47.3