In new_logline check for NULL args->reason for EVLOG_RAW.

This can't happen in practice since we never set EVLOG_RAW
without passing in a reason.  Coverity CID 237142 237143
This commit is contained in:
Todd C. Miller
2021-07-27 12:19:53 -06:00
parent e00ed390d5
commit d109cd61d9

View File

@@ -106,12 +106,14 @@ new_logline(int event_type, int flags, struct eventlog_args *args,
debug_decl(new_logline, SUDO_DEBUG_UTIL);
if (ISSET(flags, EVLOG_RAW)) {
if (args->errstr != NULL) {
if (asprintf(&line, "%s: %s", args->reason, args->errstr) == -1)
goto oom;
} else {
if ((line = strdup(args->reason)) == NULL)
goto oom;
if (args->reason != NULL) {
if (args->errstr != NULL) {
if (asprintf(&line, "%s: %s", args->reason, args->errstr) == -1)
goto oom;
} else {
if ((line = strdup(args->reason)) == NULL)
goto oom;
}
}
debug_return_str(line);
}