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:
David Henningsson 2012-03-16 14:38:38 +01:00
parent 860d1cf3a7
commit 54cddc6ddf
3 changed files with 3 additions and 3 deletions

View file

@ -2506,7 +2506,7 @@ int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save) {
return -PA_ERR_NOTIMPLEMENTED;
}
if (!s->ports)
if (!s->ports || !name)
return -PA_ERR_NOENTITY;
if (!(port = pa_hashmap_get(s->ports, name)))