From: Naveen Albert Date: Sun, 13 Nov 2022 22:15:07 +0000 (+0000) Subject: func_presencestate: Fix invalid memory access. X-Git-Tag: 18.16.0-rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30b4dc9bbbe1c65fe5a912c37d896cde2f19a3b4;p=thirdparty%2Fasterisk.git func_presencestate: Fix invalid memory access. When parsing information from AstDB while loading, it is possible that certain pointers are never set, which leads to invalid memory access and then, fatally, invalid free attempts on this memory. We now initialize to NULL to prevent this. ASTERISK-30311 #close Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929 --- diff --git a/funcs/func_presencestate.c b/funcs/func_presencestate.c index 6005e48bb4..8aba89121b 100644 --- a/funcs/func_presencestate.c +++ b/funcs/func_presencestate.c @@ -850,8 +850,8 @@ static int load_module(void) for (; db_entry; db_entry = db_entry->next) { const char *dev_name = strrchr(db_entry->key, '/') + 1; enum ast_presence_state state; - char *message; - char *subtype; + char *message = NULL; + char *subtype = NULL; if (dev_name <= (const char *) 1) { continue; }