[Asterisk-code-review] func_presencestate: Fix invalid memory access. (asterisk[20])
Friendly Automation
asteriskteam at digium.com
Thu Dec 8 10:21:27 CST 2022
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19665 )
Change subject: func_presencestate: Fix invalid memory access.
......................................................................
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
---
M funcs/func_presencestate.c
1 file changed, 19 insertions(+), 2 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/funcs/func_presencestate.c b/funcs/func_presencestate.c
index 6005e48..8aba891 100644
--- a/funcs/func_presencestate.c
+++ b/funcs/func_presencestate.c
@@ -850,8 +850,8 @@
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;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19665
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929
Gerrit-Change-Number: 19665
Gerrit-PatchSet: 2
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221208/1140f6f3/attachment-0001.html>
More information about the asterisk-code-review
mailing list