From 44820cc7eabcbf9e83de942a2f3bd2fa35c40c7b Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Mon, 28 Aug 2023 18:40:44 -0400 Subject: [PATCH] Don't read past the end of sockaddr for AF_UNIX Incoming connections for example have the 'family' set but no path. --- reprozip/native/syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reprozip/native/syscalls.c b/reprozip/native/syscalls.c index 08b65a2e..56fb2b5f 100644 --- a/reprozip/native/syscalls.c +++ b/reprozip/native/syscalls.c @@ -91,7 +91,7 @@ static int record_connection(struct Process *process, int inbound, snprintf(buffer, 512, "[%s]:%d", buf, ntohs(address_->sin6_port)); db_add_connection(process->identifier, inbound, "INET6", NULL, buffer); } - else if(family == AF_UNIX) + else if(family == AF_UNIX && addrlen > sizeof(short)) { struct sockaddr_un *address_ = address; char buf[109];