From 1d7551f70476d43a6ddd28d72ccfb1f469d87b2f Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mar 09 2021 06:18:36 +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. */