[Asterisk-code-review] res pjsip session: Access SIPDOMAIN via Dialplan. (asterisk[master])
Mark Michelson
asteriskteam at digium.com
Fri Dec 30 15:02:48 CST 2016
Mark Michelson has posted comments on this change. ( https://gerrit.asterisk.org/4651 )
Change subject: res_pjsip_session: Access SIPDOMAIN via Dialplan.
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
https://gerrit.asterisk.org/#/c/4651/1/res/res_pjsip_session.c
File res/res_pjsip_session.c:
PS1, Line 2003: size_t size = pj_strlen(&sip_ruri->host) + 1;
: char *domain = ast_malloc(size);
:
: if (domain) {
: ast_copy_pj_str(domain, &sip_ruri->host, size);
: pbx_builtin_setvar_helper(session->channel, "SIPDOMAIN", domain);
: ast_free(domain);
: }
I think malloc() is unnecessary here, given the short lifetime of the buffer. Instead, you can use ast_alloca() instead to get a stack allocation. A SIP hostname should not be large enough to cause a stack overflow.
--
To view, visit https://gerrit.asterisk.org/4651
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I27c880dc404a3c1c6792e1ba3545475339577243
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list