From a633f41986f8b6c37cbfdd487cccd23997def033 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 16 Jul 2017 16:21:07 +0200 Subject: [PATCH] server: Avoid NULL pointer dereference in make_status_items(). The previous patch (Update status items on blob events) modified the aft event handler to call make_status_items() on certain blob events because the event could have rendered the current status information stale. However, if no audio file is open at the time the event occurs, make_status_items() triggers a segfault because the ->path and ->hash members of status_item_ls_data are NULL in this case. This patch avoids the problem by returning early from make_status_items() if ->path is NULL. --- aft.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aft.c b/aft.c index 4ed703ec..36f84943 100644 --- a/aft.c +++ b/aft.c @@ -983,6 +983,8 @@ static int make_status_items(void) time_t current_time; int ret; + if (!status_item_ls_data.path) /* no audio file open */ + return 0; ret = lls_parse(ARRAY_SIZE(argv), argv, cmd, &opts.lpr, NULL); assert(ret >= 0); time(¤t_time); -- 2.39.5