Skip to content

Commit

Permalink
func_presencestate: Fix invalid memory access.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
InterLinked1 authored and jcolp committed Dec 8, 2022
1 parent 48b5a4d commit f37194e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions funcs/func_presencestate.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit f37194e

Please sign in to comment.