From e750bae75d819ff6b54e7f5949c3857654a1178d Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 2 Mar 2018 10:44:33 -0700 Subject: [PATCH] Handle parsing boolean options that have no explicit value. --- plugins/sudoers/cvtsudoers_ldif.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/sudoers/cvtsudoers_ldif.c b/plugins/sudoers/cvtsudoers_ldif.c index 5e9e67666..f44d6e71f 100644 --- a/plugins/sudoers/cvtsudoers_ldif.c +++ b/plugins/sudoers/cvtsudoers_ldif.c @@ -731,12 +731,16 @@ ldif_store_options(struct ldif_str_list *options) TAILQ_INIT(d->binding); d->type = DEFAULTS; d->op = sudo_ldap_parse_option(ls->str, &var, &val); - d->var = strdup(var); - d->val = strdup(val); - if (d->var == NULL || d->val == NULL) { + if ((d->var = strdup(var)) == NULL) { sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory")); } + if (val != NULL) { + if ((d->val = strdup(val)) == NULL) { + sudo_fatalx(U_("%s: %s"), __func__, + U_("unable to allocate memory")); + } + } TAILQ_INSERT_TAIL(&defaults, d, entries); } debug_return; -- 2.40.0