1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

coredump: allow only empty messages after first "sentinel"

This commit is contained in:
Michal Sekletar 2024-10-30 14:55:09 +01:00 committed by Luca Boccassi
parent f7d5d7c593
commit d9fd1d3707

View File

@ -1151,8 +1151,14 @@ static int process_socket(int fd) {
r = log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Received unexpected file descriptors.");
goto finish;
} else
cmsg_close_all(&mh);
}
cmsg_close_all(&mh);
/* Only zero length messages are allowed after the first message that carried a file descriptor. */
if (!first) {
r = log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Received unexpected message with non zero length.");
goto finish;
}
/* Add trailing NUL byte, in case these are strings */
((char*) iovec.iov_base)[n] = 0;