1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

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 <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Joseph Sutton 2023-10-06 10:54:57 +13:00 committed by Douglas Bagnall
parent 09655e13ea
commit 228dd73cae

View File

@ -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: