[alsa-devel] [PATCH 1/3] pcm_file: fix SEGFAULT if file option is missing while infile is not.

Andrey Mazo mazo at telum.ru
Sat Nov 16 22:11:54 CET 2013


Commit 5c5f1358123af69155267463a0b6254ad9cbecc4 requires both file and
infile options to be missing to report a failure.
In fact, only file option is mandatory and should be checked there.
Otherwise, NULL file triggers segfault in
snd_pcm_file_replace_fname() called from
snd_pcm_file_open_output_file().
infile option is optional, so don't report fatal error if it's missing.

Signed-off-by: Andrey Mazo <mazo at telum.ru>
---
 src/pcm/pcm_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c
index 5950401..3d14090 100644
--- a/src/pcm/pcm_file.c
+++ b/src/pcm/pcm_file.c
@@ -948,7 +948,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
 	err = snd_pcm_slave_conf(root, slave, &sconf, 0);
 	if (err < 0)
 		return err;
-	if ((!fname || strlen(fname) == 0) && fd < 0 && !ifname) {
+	if ((!fname || strlen(fname) == 0) && fd < 0) {
 		snd_config_delete(sconf);
 		SNDERR("file is not defined");
 		return -EINVAL;
-- 
1.8.4



More information about the Alsa-devel mailing list