[Asterisk-code-review] func_presencestate: Fix invalid memory access. (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Thu Dec 8 10:20:09 CST 2022
Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19562 )
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; Approved for Submit
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
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/+/19562
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929
Gerrit-Change-Number: 19562
Gerrit-PatchSet: 2
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
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/bc742128/attachment.html>
More information about the asterisk-code-review
mailing list