summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2024-10-30 14:55:09 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2024-10-30 20:45:31 +0100
commitd9fd1d37079b7e439d2a1a12994bdbc106015d03 (patch)
tree41409a74291385279b962eae7e0f93efa74d4d2f /src
parentnetwork/tunnel: reuse existing 6rd sit tunnel (#34938) (diff)
downloadsystemd-d9fd1d37079b7e439d2a1a12994bdbc106015d03.tar.xz
systemd-d9fd1d37079b7e439d2a1a12994bdbc106015d03.zip
coredump: allow only empty messages after first "sentinel"
Diffstat (limited to 'src')
-rw-r--r--src/coredump/coredump.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index 209d2548c2..dc725d1b22 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -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;