[PATCH GnuPG 4/7] common: check strchr for null
Sam James via Gnupg-devel <[email protected]> Wed, 28 Jan 2026 12:35:04 +0000
| Newsgroups | gmane.comp.encryption.gpg.devel |
|---|---|
| Message-ID | <cf076e471ef2b00d867d726f880c68a1bf1e53a0.1769603707.git.sam@gentoo.org> |
* common/asshelp.c (start_new_service): Check if strchr result is NULL. -- We check program_args later on before use, so it's enough to just conditionally check-then-deref-and-increment, because later on, we won't use it otherwise. Found by GCC's -fanalyzer. Signed-off-by: Sam James <[email protected]> --- common/asshelp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/asshelp.c b/common/asshelp.c index 82a7b11d0..b119c249c 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -486,7 +486,8 @@ start_new_service (assuan_context_t *r_ctx, return tmperr; } p = strchr (program, '|'); - *p++ = 0; + if (p) + *p++ = 0; program_arg = p; } -- 2.52.0