mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
protocol-native: Protect against clients trying to set a NULL port
For some reason, a badly behaving client was trying to set a NULL port, which caused PulseAudio to crash. Add safeguards on two levels just to be protected. (Also remove a redundant check.) BugLink: https://bugs.launchpad.net/bugs/951273 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
860d1cf3a7
commit
54cddc6ddf
3 changed files with 3 additions and 3 deletions
|
|
@ -4699,7 +4699,7 @@ static void command_set_sink_or_source_port(pa_pdispatch *pd, uint32_t command,
|
||||||
CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_SET_SINK_PORT ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
|
CHECK_VALIDITY(c->pstream, !name || pa_namereg_is_valid_name_or_wildcard(name, command == PA_COMMAND_SET_SINK_PORT ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE), tag, PA_ERR_INVALID);
|
||||||
CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
|
CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
|
||||||
CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
|
CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
|
||||||
CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);
|
CHECK_VALIDITY(c->pstream, port, tag, PA_ERR_INVALID);
|
||||||
|
|
||||||
if (command == PA_COMMAND_SET_SINK_PORT) {
|
if (command == PA_COMMAND_SET_SINK_PORT) {
|
||||||
pa_sink *sink;
|
pa_sink *sink;
|
||||||
|
|
|
||||||
|
|
@ -3236,7 +3236,7 @@ int pa_sink_set_port(pa_sink *s, const char *name, pa_bool_t save) {
|
||||||
return -PA_ERR_NOTIMPLEMENTED;
|
return -PA_ERR_NOTIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->ports)
|
if (!s->ports || !name)
|
||||||
return -PA_ERR_NOENTITY;
|
return -PA_ERR_NOENTITY;
|
||||||
|
|
||||||
if (!(port = pa_hashmap_get(s->ports, name)))
|
if (!(port = pa_hashmap_get(s->ports, name)))
|
||||||
|
|
|
||||||
|
|
@ -2506,7 +2506,7 @@ int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save) {
|
||||||
return -PA_ERR_NOTIMPLEMENTED;
|
return -PA_ERR_NOTIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->ports)
|
if (!s->ports || !name)
|
||||||
return -PA_ERR_NOENTITY;
|
return -PA_ERR_NOENTITY;
|
||||||
|
|
||||||
if (!(port = pa_hashmap_get(s->ports, name)))
|
if (!(port = pa_hashmap_get(s->ports, name)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue