mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Don't pass a NULL submitcwd or ttyname value to the server.
It is possible for the cwd and/or tty to be missing. If we send a NULL pointer to the server where it expects a string the AcceptMessage will fail to parse.
This commit is contained in:
parent
93f5e1be36
commit
e31e0c4d3f
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user