From d87a3e6ffffbe7422a9ad9b792dc6de2a63d75a0 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Feb 24 2021 16:08:35 +0000 Subject: Fix: libcrmcommon: Prevent a segfault in pcmk__cmdline_preproc. The list of special single-character args is optional. The function currently handles it being an empty string, but it should handle a NULL as well. --- diff --git a/lib/common/cmdline.c b/lib/common/cmdline.c index d66ccc7..66f1976 100644 --- a/lib/common/cmdline.c +++ b/lib/common/cmdline.c @@ -203,7 +203,7 @@ pcmk__cmdline_preproc(char **argv, const char *special) { * glib does not. Grab both the argument and its value and * separate them into a new argument. */ - if (strchr(special, *ch) != NULL) { + if (special != NULL && strchr(special, *ch) != NULL) { /* The argument does not occur at the end of this string of * arguments. Take everything through the end as its value. */