From 0106647ab8b6dd016e362a16ef35ded949125cf3 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Tue, 25 Aug 2020 17:48:11 +0300 Subject: [PATCH] Tests: Assert the path fits --- Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp index a25c9c89625..1f9fb5003a5 100644 --- a/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp +++ b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -47,7 +48,7 @@ int main(int, char**) struct sockaddr_un addr; memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); + ASSERT(strlcpy(addr.sun_path, path, sizeof(addr.sun_path)) < sizeof(addr.sun_path)); rc = bind(fd, (struct sockaddr*)(&addr), sizeof(addr)); if (rc < 0 && errno == EADDRINUSE) {