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
This commit is contained in:
Barnabás Pőcze 2022-01-13 13:21:28 +01:00
parent 11db00abdf
commit 60818886ed

View file

@ -477,7 +477,7 @@ on_connect(void *data, int fd, uint32_t mask)
{ {
struct server *server = data; struct server *server = data;
struct impl *impl = server->impl; struct impl *impl = server->impl;
struct sockaddr addr; struct sockaddr_in addr;
socklen_t addrlen; socklen_t addrlen;
int client_fd, val; int client_fd, val;
struct client *client = NULL; 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); spa_list_append(&server->client_list, &client->link);
server->n_clients++; 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); snprintf(client->name, sizeof(client->name), "client %d", client_fd);
client->source = pw_loop_add_io(impl->loop, client->source = pw_loop_add_io(impl->loop,