sd-netlink: prepare buffer for dropping unexpected message

Follow-up for c7460cce79 (v219).

Fixes #35654.
This commit is contained in:
Yu Watanabe
2025-04-17 01:52:17 +01:00
committed by Luca Boccassi
parent ec65c29e51
commit bf478dcffb
@@ -181,6 +181,12 @@ static int socket_recv_message(int fd, void *buf, size_t buf_size, uint32_t *ret
log_debug("sd-netlink: ignoring message from PID %"PRIu32, sender.nl.nl_pid);
if (peek) {
_cleanup_free_ uint8_t *b = new(uint8_t, n);
if (!b)
return -ENOMEM;
iov = IOVEC_MAKE(b, n);
/* drop the message */
n = recvmsg_safe(fd, &msg, 0);
if (n < 0)