summaryrefslogtreecommitdiff
path: root/res/res_pjsip_endpoint_identifier_anonymous.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-11-17 10:57:54 -0500
committerSean Bright <sean.bright@gmail.com>2017-11-17 11:22:10 -0500
commit3c72064d3fdc246ead752bb00b74620a4c05186f (patch)
treedd39eee954f1ede5871da834648249b3d9351691 /res/res_pjsip_endpoint_identifier_anonymous.c
parentef8ee3ee69fb1b2f9bb2694217d8dfdf124d251f (diff)
res_pjsip: Use reasonable buffer lengths for endpoint identification
Domains themselves can be up to 255 characters long (per RFC 1035), so our current buffer sizes are wholly inadequate for many use cases. Change-Id: If3f30a68307f1365a1fe06bc4b854c62842c9292
Diffstat (limited to 'res/res_pjsip_endpoint_identifier_anonymous.c')
-rw-r--r--res/res_pjsip_endpoint_identifier_anonymous.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_pjsip_endpoint_identifier_anonymous.c b/res/res_pjsip_endpoint_identifier_anonymous.c
index b93133824..2a47cbe3f 100644
--- a/res/res_pjsip_endpoint_identifier_anonymous.c
+++ b/res/res_pjsip_endpoint_identifier_anonymous.c
@@ -56,9 +56,11 @@ static int find_transport_state_in_use(void *obj, void *arg, int flags)
return 0;
}
+#define DOMAIN_NAME_LEN 255
+
static struct ast_sip_endpoint *anonymous_identify(pjsip_rx_data *rdata)
{
- char domain_name[64], id[AST_UUID_STR_LEN];
+ char domain_name[DOMAIN_NAME_LEN + 1];
struct ast_sip_endpoint *endpoint;
RAII_VAR(struct ast_sip_domain_alias *, alias, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, transport_states, NULL, ao2_cleanup);
@@ -70,6 +72,8 @@ static struct ast_sip_endpoint *anonymous_identify(pjsip_rx_data *rdata)
}
if (!ast_sip_get_disable_multi_domain()) {
+ char id[sizeof("anonymous@") + DOMAIN_NAME_LEN];
+
/* Attempt to find the endpoint given the name and domain provided */
snprintf(id, sizeof(id), "anonymous@%s", domain_name);
if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) {