mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-02 06:46:36 -04:00
security: fix JSON injection in simple-protocol-tcp address
The listen address was inserted into a JSON array without escaping. Build the address string first, then encode it with spa_json_encode_string. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0ae17566f2
commit
390874e7c3
1 changed files with 8 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
|||
/* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans <wim.taymans@gmail.com> */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#include <spa/utils/json.h>
|
||||
#include <pipewire/impl.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
|
|
@ -169,8 +170,13 @@ static int module_simple_protocol_tcp_prepare(struct module * const module)
|
|||
port = "4711";
|
||||
listen = pw_properties_get(props, "listen");
|
||||
|
||||
pw_properties_setf(module_props, "server.address", "[ \"tcp:%s%s%s\" ]",
|
||||
listen ? listen : "", listen ? ":" : "", port);
|
||||
{
|
||||
char address[1024], encoded[1024];
|
||||
snprintf(address, sizeof(address), "tcp:%s%s%s",
|
||||
listen ? listen : "", listen ? ":" : "", port);
|
||||
spa_json_encode_string(encoded, sizeof(encoded), address);
|
||||
pw_properties_setf(module_props, "server.address", "[ %s ]", encoded);
|
||||
}
|
||||
|
||||
d->module = module;
|
||||
d->module_props = module_props;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue