From 090c031c1a60ee398aa1e1bff25418b1d50583aa Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 28 Jul 2020 13:15:10 +0200 Subject: [PATCH] Userland: Fix nc by not memset()'ing the input address char* We were accidentally calling memset() on "addr" (the input char*), not "dst_addr" (the target struct sockaddr_in), which was causing a simple "nc localhost 8000" to crash. Fixes #2908. --- Userland/nc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/nc.cpp b/Userland/nc.cpp index 100be8e849..13fee77f10 100644 --- a/Userland/nc.cpp +++ b/Userland/nc.cpp @@ -133,7 +133,7 @@ int main(int argc, char** argv) char addr_str[100]; struct sockaddr_in dst_addr; - memset(&addr, 0, sizeof(addr)); + memset(&dst_addr, 0, sizeof(dst_addr)); dst_addr.sin_family = AF_INET; dst_addr.sin_port = htons(port);