libcamera: ipc_unixsocket: Don't send uninitialized bytes over the socket

IPCUnixSocket::send() sends a IPCUnixSocket::Header allocated on the
stack. All the fields of the header are initialized, but the padding
bytes are not. This results in random data being sent over the UNIX
socket, potentially leaking information.

Fix this by initializing the whole header to 0.

Fixes: 13dd7a01ec ("libcamera: ipc: unix: Add a IPC mechanism based on Unix sockets")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2020-01-04 07:38:37 +02:00
parent abce49655a
commit a0c31b2ca3

View File

@@ -172,7 +172,7 @@ int IPCUnixSocket::send(const Payload &payload)
if (!isBound())
return -ENOTCONN;
Header hdr;
Header hdr = {};
hdr.data = payload.data.size();
hdr.fds = payload.fds.size();