Static analyser cppcheck says: 1. samba-4.23.1/lib/texpect/texpect.c:301:15: style: Array index 'i' is used before limits check. [arrayIndexThenCheck] Source code is if (c->str[i] == '\\' && i < len - 1) { 2. samba-4.23.1/source3/smbd/mangle_hash2.c:368:17: style: Array index 'i' is used before limits check. [arrayIndexThenCheck] 3. samba-4.23.1/source3/smbd/smb1_message.c:90:11: style: Array index 'i' is used before limits check. [arrayIndexThenCheck] 4. samba-4.23.1/source4/dsdb/samdb/ldb_modules/password_hash.c:1575:24: style: Array index 'i' is used before limits check. [arrayIndexThenCheck] 5. samba-4.23.1/source4/ntvfs/posix/pvfs_shortname.c:185:17: style: Array index 'i' is used before limits check. [arrayIndexThenCheck]
(1) is fine because `i < len` is the precondition for the loop. (2) looks funny but is fine because the string is null‐terminated. (3) has both checks in the correct places. (4) also looks a little funny, but works because rp is null‐terminated. (5) is the same as (2).