From: Andre Noll Date: Sun, 16 Jul 2017 14:21:07 +0000 (+0200) Subject: server: Avoid NULL pointer dereference in make_status_items(). X-Git-Tag: v0.6.1~18^2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=a633f41986f8b6c37cbfdd487cccd23997def033;p=paraslash.git 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. --- 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);