97434d
From df1f5c4d70d0c19ad40072f5246ca457e7f9849e Mon Sep 17 00:00:00 2001
97434d
From: Joshua Hill <posixninja@gmail.com>
97434d
Date: Tue, 29 Dec 2015 22:27:17 +0100
97434d
Subject: [PATCH] common: [security fix] Make sure sockets only listen locally
97434d
97434d
---
97434d
 common/socket.c | 4 ++--
97434d
 1 file changed, 2 insertions(+), 2 deletions(-)
97434d
97434d
diff --git a/common/socket.c b/common/socket.c
97434d
index b276864..e2968a6 100644
97434d
--- a/common/socket.c
97434d
+++ b/common/socket.c
97434d
@@ -172,7 +172,7 @@ int socket_create(uint16_t port)
97434d
 
97434d
 	memset((void *) &saddr, 0, sizeof(saddr));
97434d
 	saddr.sin_family = AF_INET;
97434d
-	saddr.sin_addr.s_addr = htonl(INADDR_ANY);
97434d
+	saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
97434d
 	saddr.sin_port = htons(port);
97434d
 
97434d
 	if (0 > bind(sfd, (struct sockaddr *) &saddr, sizeof(saddr))) {
97434d
@@ -329,7 +329,7 @@ int socket_accept(int fd, uint16_t port)
97434d
 
97434d
 	memset(&addr, 0, sizeof(addr));
97434d
 	addr.sin_family = AF_INET;
97434d
-	addr.sin_addr.s_addr = htonl(INADDR_ANY);
97434d
+	addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
97434d
 	addr.sin_port = htons(port);
97434d
 
97434d
 	addr_len = sizeof(addr);