From 23c26c5e01d272338eef8b88243c35c0ebd9cd90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 21 Jul 2015 16:15:07 +0200 Subject: [PATCH] Check for undefined stream format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit format element is mandatory but the server will crash if it does not exist in the configuration file. This patch handle the case gracefully. It does not raise an error on unsupported value because documentation allows it. Signed-off-by: Petr Písař --- src/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.c b/src/util.c index 9ecd430..20c2acc 100644 --- a/src/util.c +++ b/src/util.c @@ -135,6 +135,11 @@ stream_setup(const char *host, unsigned short port, const char *mount) return (NULL); } + if (NULL == pezConfig->format) { + printf("%s: stream format is missing\n", __progname); + shout_free(shout); + return (NULL); + } if (!strcmp(pezConfig->format, MP3_FORMAT) && shout_set_format(shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) { printf("%s: shout_set_format(MP3): %s\n",