diff --git a/plugins/sudoers/iolog_client.c b/plugins/sudoers/iolog_client.c index 789b7c9a3..7db5b9860 100644 --- a/plugins/sudoers/iolog_client.c +++ b/plugins/sudoers/iolog_client.c @@ -746,10 +746,12 @@ fmt_accept_message(struct client_closure *closure) accept_msg.info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRVAL; n++; - accept_msg.info_msgs[n]->key = "submitcwd"; - accept_msg.info_msgs[n]->strval = (char *)details->cwd; - accept_msg.info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRVAL; - n++; + if (details->cwd != NULL) { + accept_msg.info_msgs[n]->key = "submitcwd"; + accept_msg.info_msgs[n]->strval = (char *)details->cwd; + accept_msg.info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRVAL; + n++; + } /* TODO - submitenv */ /* TODO - submitgid */ @@ -769,10 +771,12 @@ fmt_accept_message(struct client_closure *closure) accept_msg.info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRVAL; n++; - accept_msg.info_msgs[n]->key = "ttyname"; - accept_msg.info_msgs[n]->strval = (char *)details->tty; - accept_msg.info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRVAL; - n++; + if (details->tty != NULL) { + accept_msg.info_msgs[n]->key = "ttyname"; + accept_msg.info_msgs[n]->strval = (char *)details->tty; + accept_msg.info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRVAL; + n++; + } /* Update n_info_msgs. */ accept_msg.n_info_msgs = n;