From 459b7f7d24069674a63913d03e35586b484dbb95 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 14 Nov 2023 19:09:25 +0100 Subject: [PATCH] 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) --- src/setproctitle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'; }