From 60818886ed99948adcbe0a75e4bb65d8321ef1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 13 Jan 2022 13:21:28 +0100 Subject: [PATCH] pipewire: module-protocol-simple: fix `inet_ntop()` call Previously, the buffer argument was a pointer which did not point to the address portion of an AF_INET address. See #2017 --- src/modules/module-protocol-simple.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/module-protocol-simple.c b/src/modules/module-protocol-simple.c index 71fde92d1..4fe85c839 100644 --- a/src/modules/module-protocol-simple.c +++ b/src/modules/module-protocol-simple.c @@ -477,7 +477,7 @@ on_connect(void *data, int fd, uint32_t mask) { struct server *server = data; struct impl *impl = server->impl; - struct sockaddr addr; + struct sockaddr_in addr; socklen_t addrlen; int client_fd, val; struct client *client = NULL; @@ -503,7 +503,7 @@ on_connect(void *data, int fd, uint32_t mask) spa_list_append(&server->client_list, &client->link); server->n_clients++; - if (inet_ntop(addr.sa_family, addr.sa_data, client->name, sizeof(client->name)) == NULL) + if (inet_ntop(addr.sin_family, &addr.sin_addr.s_addr, client->name, sizeof(client->name)) == NULL) snprintf(client->name, sizeof(client->name), "client %d", client_fd); client->source = pw_loop_add_io(impl->loop,