]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod get_play_time_slot_num(): Avoid possible NULL pointer dereference.
authorAndre Noll <maan@systemlinux.org>
Thu, 3 Feb 2011 16:12:53 +0000 (17:12 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 7 Jul 2011 15:28:38 +0000 (17:28 +0200)
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.

audiod_command.c

index 05059ac06d2ff7f23a9648e14e54c71c904bfa9d..a0d0229d6973566296f0fc18b1aa987aacfd4c98 100644 (file)
@@ -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;
        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)
                        continue;
                btr_get_node_start(s->wns[0].btrn, &wstime);
                if (oldest_slot >= 0 && tv_diff(&wstime, &oldest_wstime, NULL) > 0)