From: Joseph Sutton Date: Thu, 5 Oct 2023 21:54:57 +0000 (+1300) Subject: util:charset: Remove unreachable code (CID 1272948) X-Git-Tag: tdb-1.4.13~1278 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=228dd73cae7ee6181c01f0aca87830afa8bf19d5;p=thirdparty%2Fsamba.git util:charset: Remove unreachable code (CID 1272948) 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 --- 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: