From ee80f7169abdae8da990657da393dda7e3506683 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Tue, 30 Jan 2018 08:58:20 +0100 Subject: [PATCH] act-user: Prevent segfault if accounts_proxy is not created act_user_get_locked may segfault if accounts_proxy is not created (e.g. when run under root). All other functions which rely on accounts_proxy already contain checks for NULL and valid ActUser. Do the same also in act_user_get_locked in order to avoid segfaults in certain cases. https://bugs.freedesktop.org/show_bug.cgi?id=104851 --- src/libaccountsservice/act-user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libaccountsservice/act-user.c b/src/libaccountsservice/act-user.c index da46bc5..e7ceb24 100644 --- a/src/libaccountsservice/act-user.c +++ b/src/libaccountsservice/act-user.c @@ -887,6 +887,11 @@ act_user_is_logged_in_anywhere (ActUser *user) gboolean act_user_get_locked (ActUser *user) { + g_return_val_if_fail (ACT_IS_USER (user), TRUE); + + if (user->accounts_proxy == NULL) + return TRUE; + return accounts_user_get_locked (user->accounts_proxy); } -- 2.16.1