* 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


_______________________________________________
Gnupg-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-devel

Reply via email to