From 5fc6e81242ca29a6fad80f7d57cd96ef65b2300f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 20 Dec 2018 23:56:51 +0100 Subject: [PATCH] [sink_sndfile] preset_format does not fail on empty format string --- src/io/sink_sndfile.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/io/sink_sndfile.c b/src/io/sink_sndfile.c index 94277529..5b168a4b 100644 --- a/src/io/sink_sndfile.c +++ b/src/io/sink_sndfile.c @@ -136,10 +136,12 @@ uint_t aubio_sink_sndfile_preset_format(aubio_sink_sndfile_t *s, } else if (atoi(fmt) > 0x010000) { s->format = atoi(fmt); } else { - AUBIO_WRN("sink_sndfile: could not guess format for %s," - " using default (wav)\n", s->path); s->format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; - return AUBIO_FAIL; + if (fmt && strnlen(fmt, PATH_MAX)) { + AUBIO_WRN("sink_sndfile: could not guess format %s for %s," + " using default (wav)\n", fmt, s->path); + return AUBIO_FAIL; + } } return AUBIO_OK; } -- 2.11.0