mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 15:25:58 +00:00
It is possible for evlog->argv or evlog->envp to be NULL.
This commit is contained in:
@@ -786,19 +786,23 @@ fmt_info_messages(struct client_closure *closure, size_t *n_info_msgs)
|
|||||||
debug_decl(fmt_info_messages, SUDOERS_DEBUG_UTIL);
|
debug_decl(fmt_info_messages, SUDOERS_DEBUG_UTIL);
|
||||||
|
|
||||||
/* Convert NULL-terminated vectors to StringList. */
|
/* Convert NULL-terminated vectors to StringList. */
|
||||||
if ((runargv = malloc(sizeof(*runargv))) == NULL)
|
if (evlog->argv != NULL) {
|
||||||
goto bad;
|
if ((runargv = malloc(sizeof(*runargv))) == NULL)
|
||||||
info_message__string_list__init(runargv);
|
goto bad;
|
||||||
runargv->strings = evlog->argv;
|
info_message__string_list__init(runargv);
|
||||||
while (runargv->strings[runargv->n_strings] != NULL)
|
runargv->strings = evlog->argv;
|
||||||
runargv->n_strings++;
|
while (runargv->strings[runargv->n_strings] != NULL)
|
||||||
|
runargv->n_strings++;
|
||||||
|
}
|
||||||
|
|
||||||
if ((runenv = malloc(sizeof(*runenv))) == NULL)
|
if (evlog->envp != NULL) {
|
||||||
goto bad;
|
if ((runenv = malloc(sizeof(*runenv))) == NULL)
|
||||||
info_message__string_list__init(runenv);
|
goto bad;
|
||||||
runenv->strings = evlog->envp;
|
info_message__string_list__init(runenv);
|
||||||
while (runenv->strings[runenv->n_strings] != NULL)
|
runenv->strings = evlog->envp;
|
||||||
runenv->n_strings++;
|
while (runenv->strings[runenv->n_strings] != NULL)
|
||||||
|
runenv->n_strings++;
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX - realloc as needed instead of preallocating */
|
/* XXX - realloc as needed instead of preallocating */
|
||||||
info_msgs_size = 24;
|
info_msgs_size = 24;
|
||||||
@@ -835,17 +839,21 @@ fmt_info_messages(struct client_closure *closure, size_t *n_info_msgs)
|
|||||||
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_NUMVAL;
|
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_NUMVAL;
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
info_msgs[n]->key = "runargv";
|
if (runargv != NULL) {
|
||||||
info_msgs[n]->u.strlistval = runargv;
|
info_msgs[n]->key = "runargv";
|
||||||
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRLISTVAL;
|
info_msgs[n]->u.strlistval = runargv;
|
||||||
n++;
|
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRLISTVAL;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
info_msgs[n]->key = "runenv";
|
if (runenv != NULL) {
|
||||||
info_msgs[n]->u.strlistval = runenv;
|
info_msgs[n]->key = "runenv";
|
||||||
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRLISTVAL;
|
info_msgs[n]->u.strlistval = runenv;
|
||||||
n++;
|
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_STRLISTVAL;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
if (evlog->rungroup!= NULL) {
|
if (evlog->rungroup != NULL) {
|
||||||
info_msgs[n]->key = "rungid";
|
info_msgs[n]->key = "rungid";
|
||||||
info_msgs[n]->u.numval = evlog->rungid;
|
info_msgs[n]->u.numval = evlog->rungid;
|
||||||
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_NUMVAL;
|
info_msgs[n]->value_case = INFO_MESSAGE__VALUE_NUMVAL;
|
||||||
|
Reference in New Issue
Block a user