mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-05 06:46:28 -04:00
jack: fix some potential NULL pointer derefs
If the client has no pid property, don't try to atoi a NULL string. If the : is stripped of a very long port name, don't return a NULL+1 string in port_short_name(). Don't deref a potential NULL port in debug log.
This commit is contained in:
parent
16ba0ef59b
commit
62dbd49f5a
1 changed files with 4 additions and 4 deletions
|
|
@ -3790,7 +3790,8 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
if ((str = spa_dict_lookup(props, PW_KEY_SEC_PID)) != NULL) {
|
if ((str = spa_dict_lookup(props, PW_KEY_SEC_PID)) != NULL) {
|
||||||
pw_log_debug("%p: pid of \"%s\" is \"%s\"", c, app, str);
|
pw_log_debug("%p: pid of \"%s\" is \"%s\"", c, app, str);
|
||||||
} else {
|
} else {
|
||||||
pw_log_debug("%p: pid of \"%s\" is unknown", c, app);
|
pw_log_warn("%p: pid of \"%s\" is unknown", c, app);
|
||||||
|
str = "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
o = alloc_object(c, INTERFACE_Client);
|
o = alloc_object(c, INTERFACE_Client);
|
||||||
|
|
@ -5986,7 +5987,8 @@ const char * jack_port_short_name (const jack_port_t *port)
|
||||||
return_val_if_fail(o != NULL, NULL);
|
return_val_if_fail(o != NULL, NULL);
|
||||||
if (o->type != INTERFACE_Port)
|
if (o->type != INTERFACE_Port)
|
||||||
return NULL;
|
return NULL;
|
||||||
return strchr(port_name(o), ':') + 1;
|
const char *p = strchr(port_name(o), ':');
|
||||||
|
return p ? p + 1 : port_name(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -6582,8 +6584,6 @@ int jack_disconnect (jack_client_t *client,
|
||||||
src = find_port_by_name(c, source_port);
|
src = find_port_by_name(c, source_port);
|
||||||
dst = find_port_by_name(c, destination_port);
|
dst = find_port_by_name(c, destination_port);
|
||||||
|
|
||||||
pw_log_debug("%p: %d %d", client, src->id, dst->id);
|
|
||||||
|
|
||||||
if (src == NULL || dst == NULL ||
|
if (src == NULL || dst == NULL ||
|
||||||
!(src->port.flags & JackPortIsOutput) ||
|
!(src->port.flags & JackPortIsOutput) ||
|
||||||
!(dst->port.flags & JackPortIsInput)) {
|
!(dst->port.flags & JackPortIsInput)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue