1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-06-09 06:10:42 +00:00

Check for undefined stream format

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.

<https://bugzilla.redhat.com/show_bug.cgi?id=1244481>

Signed-off-by: Petr Písař <ppisar@redhat.com>
This commit is contained in:
Petr Písař 2015-07-21 16:15:07 +02:00 committed by Moritz Grimm
parent ee0700992e
commit 23c26c5e01

View File

@ -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",