[Asterisk-code-review] GCC12: Fixes for 18+. state_id_by_topic comparing wrong value (asterisk[19])

Friendly Automation asteriskteam at digium.com
Mon May 9 07:55:24 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18509 )

Change subject: GCC12: Fixes for 18+.  state_id_by_topic comparing wrong value
......................................................................

GCC12: Fixes for 18+.  state_id_by_topic comparing wrong value

GCC 12 caught an issue in state_id_by_topic where we were
checking a pointer for NULL instead of the contents of
the pointer for '\0'.

ASTERISK-30044

Change-Id: Ia0b04d4fff45c92acb7f07132a33622fa341148e
---
M main/stasis_state.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/main/stasis_state.c b/main/stasis_state.c
index 75093a0..decf228 100644
--- a/main/stasis_state.c
+++ b/main/stasis_state.c
@@ -113,7 +113,7 @@
 	id = strchr(stasis_topic_name(state_topic), '/');
 
 	/* The state's unique id should always exist */
-	ast_assert(id != NULL && (id + 1) != NULL);
+	ast_assert(id != NULL && *(id + 1) != '\0');
 
 	return (id + 1);
 }

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18509
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: Ia0b04d4fff45c92acb7f07132a33622fa341148e
Gerrit-Change-Number: 18509
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220509/d91892d4/attachment.html>


More information about the asterisk-code-review mailing list