From: Guillem Jover Date: Tue, 14 Nov 2023 18:09:25 +0000 (+0100) Subject: Do not confuse code analyzers with out-of-bounds array access look alike X-Git-Tag: 0.11.8~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=459b7f7d24069674a63913d03e35586b484dbb95;p=thirdparty%2Flibbsd.git Do not confuse code analyzers with out-of-bounds array access look alike The code is only getting the address, but we might be performing an addressing that is out-of-bounds. Avoid it and use the address form instead. Warned-by: cppcheck (objectIndex) --- diff --git a/src/setproctitle.c b/src/setproctitle.c index 3aff064..d77d67f 100644 --- a/src/setproctitle.c +++ b/src/setproctitle.c @@ -284,7 +284,7 @@ setproctitle_impl(const char *fmt, ...) if (nul < SPT.nul) { *SPT.nul = '.'; - } else if (nul == SPT.nul && &nul[1] < SPT.end) { + } else if (nul == SPT.nul && (nul + 1) < SPT.end) { *SPT.nul = ' '; *++nul = '\0'; }