From c9987a061652001cd2b60cbdb30d0e340ac06c27 Mon Sep 17 00:00:00 2001 From: Troy Date: Tue, 22 Sep 2026 09:30:26 +1000 Subject: [PATCH] Fix null dereference in ListenUnix and ConnectUnix --- include/znc/Socket.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/znc/Socket.h b/include/znc/Socket.h index 60173e4a..dc3c8819 100644 --- a/include/znc/Socket.h +++ b/include/znc/Socket.h @@ -161,6 +161,9 @@ class CSockManager : public TSocketManager, bool ListenUnix(const CString& sSockName, const CString& sPath, CZNCSock* pcSock = nullptr) { + if (!pcSock) { + pcSock = GetSockObj("", 0); + } if (pcSock->ListenUnixInternal(sPath)) { AddSock(pcSock, sSockName); return true; @@ -172,6 +175,9 @@ class CSockManager : public TSocketManager, bool ConnectUnix(const CString& sSockName, const CString& sPath, CZNCSock* pcSock = nullptr) { + if (!pcSock) { + pcSock = GetSockObj("", 0); + } if (pcSock->ConnectUnixInternal(sPath)) { AddSock(pcSock, sSockName); return true;