summaryrefslogtreecommitdiff
path: root/src/modules/module-stream-restore.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2020-05-26 14:57:42 +0300
committerGeorg Chini <georg@chini.tk>2020-06-01 18:24:16 +0000
commit2ac2b445fcb81a3e6439e94cdefc2a482eab4fd1 (patch)
tree2ae08a78d8a1a53fd9cfd6846073af7bb8fdc34a /src/modules/module-stream-restore.c
parent46c263acc976a9615a322cff5ead41928c68e6ce (diff)
downloadpulseaudio-2ac2b445fcb81a3e6439e94cdefc2a482eab4fd1.tar.gz
stream-restore: Fix a potential crash in pa_namereg_is_valid_name()
pa_namereg_is_valid_name() will hit an assertion if the name string is NULL. Maybe it would make sense to change pa_namereg_is_valid_name() so that it would return false on NULL, but I didn't want to change the function semantics at this time. e->device and e->card can be NULL even when device_valid and card_valid are set to true if the database contains bad data. I ran into this crash while developing new code, I haven't seen the crash in the wild.
Diffstat (limited to 'src/modules/module-stream-restore.c')
-rw-r--r--src/modules/module-stream-restore.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index b6358fcca..a86e6bc31 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1144,12 +1144,12 @@ static struct entry *entry_read(struct userdata *u, const char *name) {
if (!pa_tagstruct_eof(t))
goto fail;
- if (e->device_valid && !pa_namereg_is_valid_name(e->device)) {
+ if (e->device_valid && (!e->device || !pa_namereg_is_valid_name(e->device))) {
pa_log_warn("Invalid device name stored in database for stream %s", name);
goto fail;
}
- if (e->card_valid && !pa_namereg_is_valid_name(e->card)) {
+ if (e->card_valid && (!e->card || !pa_namereg_is_valid_name(e->card))) {
pa_log_warn("Invalid card name stored in database for stream %s", name);
goto fail;
}