summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joshua Hill2015-12-29 23:09:37 +0100
committerGravatar Nikias Bassen2015-12-29 23:09:37 +0100
commit4397b3376dc4e4cb1c991d0aed61ce6482614196 (patch)
tree988af170631b3fe0611b997a6cc1ae2b10788ae6
parent4d365eefe8255e8f693bce008dc71bf415279c7e (diff)
downloadlibusbmuxd-4397b3376dc4e4cb1c991d0aed61ce6482614196.tar.gz
libusbmuxd-4397b3376dc4e4cb1c991d0aed61ce6482614196.tar.bz2
common: [security fix] Make sure sockets only listen locally
-rw-r--r--common/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/socket.c b/common/socket.c
index 27b93ba..4cdefd6 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -203,7 +203,7 @@ int socket_create(uint16_t port)
memset((void *) &saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
- saddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
saddr.sin_port = htons(port);
if (0 > bind(sfd, (struct sockaddr *) &saddr, sizeof(saddr))) {
@@ -368,7 +368,7 @@ int socket_accept(int fd, uint16_t port)
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
addr.sin_port = htons(port);
addr_len = sizeof(addr);