Use a consistent version of fuzz_conversation() with all fuzzers.

Also undo a change to fuzz_sudoers.c that snuck in to the last commit.
This commit is contained in:
Todd C. Miller
2021-09-28 20:20:28 -06:00
parent 7d964875df
commit eefb7b0d54
8 changed files with 143 additions and 14 deletions

View File

@@ -37,6 +37,25 @@ static int
fuzz_conversation(int num_msgs, const struct sudo_conv_message msgs[],
struct sudo_conv_reply replies[], struct sudo_conv_callback *callback)
{
int n;
for (n = 0; n < num_msgs; n++) {
const struct sudo_conv_message *msg = &msgs[n];
switch (msg->msg_type & 0xff) {
case SUDO_CONV_PROMPT_ECHO_ON:
case SUDO_CONV_PROMPT_MASK:
case SUDO_CONV_PROMPT_ECHO_OFF:
/* input not supported */
return -1;
case SUDO_CONV_ERROR_MSG:
case SUDO_CONV_INFO_MSG:
/* no output for fuzzers */
break;
default:
return -1;
}
}
return 0;
}