From: Andre Noll Date: Thu, 3 Feb 2011 16:12:53 +0000 (+0100) Subject: audiod get_play_time_slot_num(): Avoid possible NULL pointer dereference. X-Git-Tag: v0.4.8~22^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=de2a0b8fa6c9f7dbee01ef989c4ca1f450a7af8b audiod get_play_time_slot_num(): Avoid possible NULL pointer dereference. The pointer to the buffer tree node is dereferenced unconditionally in btr_get_node_start(). This patch makes sure we never pass a NULL pointer to this function. --- diff --git a/audiod_command.c b/audiod_command.c index 05059ac0..a0d0229d 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -198,7 +198,7 @@ static int get_play_time_slot_num(void) FOR_EACH_SLOT(i) { struct slot_info *s = &slot[i]; struct timeval wstime; - if (!s->wns) + if (!s->wns || !s->wns[0].btrn) continue; btr_get_node_start(s->wns[0].btrn, &wstime); if (oldest_slot >= 0 && tv_diff(&wstime, &oldest_wstime, NULL) > 0)