From 2b96fdfd2501d7c4728d506a33ecc4575ac66f48 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 4 Sep 2011 12:54:41 +0200 Subject: [PATCH] stream-restore: Add proper data validity checks to the legacy database entry read. --- src/modules/module-stream-restore.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c index 22659df5..4d0686f9 100644 --- a/src/modules/module-stream-restore.c +++ b/src/modules/module-stream-restore.c @@ -1077,6 +1077,26 @@ static struct entry* legacy_entry_read(struct userdata *u, pa_datum *data) { return NULL; } + if (le->device_valid && !pa_namereg_is_valid_name(le->device)) { + pa_log_warn("Invalid device name stored in database for legacy stream"); + return NULL; + } + + if (le->card_valid && !pa_namereg_is_valid_name(le->card)) { + pa_log_warn("Invalid card name stored in database for legacy stream"); + return NULL; + } + + if (le->volume_valid && !pa_channel_map_valid(&le->channel_map)) { + pa_log_warn("Invalid channel map stored in database for legacy stream"); + return NULL; + } + + if (le->volume_valid && (!pa_cvolume_valid(&le->volume) || !pa_cvolume_compatible_with_channel_map(&le->volume, &le->channel_map))) { + pa_log_warn("Invalid volume stored in database for legacy stream"); + return NULL; + } + e = entry_new(); e->muted_valid = le->muted_valid; e->muted = le->muted; -- 2.39.2