Skip to content

Commit e1fad8a

Browse files
committed
iolog_write_info_file_legacy: ignore evlog->runargv if NULL
The sudo logsrvd protocol allows runargv to be ommitted, so don't try to dereference runargv if it is not set. This fixes a crash in sudo_logsrvd when an AcceptMessage is received that has no runargv InfoMessage included. First reported by Pedro Henrique de Almeida Silva of the Stack Security Intelligence Research Team Also reported by Samuel Ferenc Berecz and Oguz Bektas
1 parent 64421ac commit e1fad8a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/iolog/iolog_loginfo.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ iolog_write_info_file_legacy(int dfd, struct eventlog *evlog)
126126
evlog->lines, evlog->columns,
127127
evlog->cwd ? evlog->cwd : "unknown");
128128
fputs(evlog->command ? evlog->command : "unknown", fp);
129-
for (av = evlog->runargv + 1; *av != NULL; av++) {
130-
fputc(' ', fp);
131-
fputs(*av, fp);
129+
if (evlog->runargv != NULL && evlog->runargv[0] != NULL) {
130+
for (av = evlog->runargv + 1; *av != NULL; av++) {
131+
fputc(' ', fp);
132+
fputs(*av, fp);
133+
}
132134
}
133135
fputc('\n', fp);
134136
fflush(fp);

0 commit comments

Comments
 (0)