From: Seven Du Date: Sat, 5 Mar 2016 12:32:40 +0000 (+0800) Subject: FS-8811 fix divide by 0 X-Git-Tag: v1.6.7~2^2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0c76fab805b56aaafb0b64be32adda1427137b2;p=thirdparty%2Ffreeswitch.git FS-8811 fix divide by 0 --- diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index 80de543fca..b704e8b83a 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -183,6 +183,8 @@ static int do_rand(uint32_t count) { int r = 0; + if (count == 0) return 0; + switch_mutex_lock(globals.mutex); r = (rand() % count) + 1; switch_mutex_unlock(globals.mutex);