From 01ae3b0bbdca75a21e49699736f95c2c835527f3 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 17 Aug 2022 18:05:37 +0300 Subject: [PATCH 20/20] Fix NULL dereference in entry_bool_get() See osdn #45008 Signed-off-by: Marko Lindqvist --- utility/registry_ini.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utility/registry_ini.c b/utility/registry_ini.c index 73f3626576..d1aad87494 100644 --- a/utility/registry_ini.c +++ b/utility/registry_ini.c @@ -3323,7 +3323,7 @@ static inline void entry_use(struct entry *pentry) } /************************************************************************** - Gets an boolean value. Returns TRUE on success. + Gets an boolean value. Returns TRUE on success. On old saved files, 0 and 1 can also be considered as bool. **************************************************************************/ bool entry_bool_get(const struct entry *pentry, bool *value) @@ -3340,7 +3340,9 @@ bool entry_bool_get(const struct entry *pentry, bool *value) return TRUE; } - SECFILE_RETURN_VAL_IF_FAIL(pentry->psection->secfile, pentry->psection, + SECFILE_RETURN_VAL_IF_FAIL(pentry->psection != NULL + ? pentry->psection->secfile : NULL, + pentry->psection, ENTRY_BOOL == pentry->type, FALSE); if (NULL != value) { -- 2.35.1