AST-2016-004: Fix crash on REGISTER with long URI.

Due to some ignored return values, Asterisk could crash if processing an
incoming REGISTER whose contact URI was above a certain length.

ASTERISK-25707 #close
Reported by George Joseph

Patches:
	0001-res_pjsip-Validate-that-URIs-don-t-exceed-pjproject-.patch

AST-2016-004

Change-Id: I0ed3898fe7ab10121b76c8c79046692de3a1be55
This commit is contained in:
Mark Michelson
2016-04-14 07:15:47 -05:00
parent 1f853df29c
commit 0b4bb19e0b
4 changed files with 93 additions and 2 deletions

View File

@@ -1290,10 +1290,18 @@ static int sip_outbound_registration_apply(const struct ast_sorcery *sorcery, vo
ast_log(LOG_ERROR, "No server URI specified on outbound registration '%s'\n",
ast_sorcery_object_get_id(applied));
return -1;
} else if (ast_sip_validate_uri_length(applied->server_uri)) {
ast_log(LOG_ERROR, "Server URI or hostname length exceeds pjpropject limit '%s'\n",
ast_sorcery_object_get_id(applied));
return -1;
} else if (ast_strlen_zero(applied->client_uri)) {
ast_log(LOG_ERROR, "No client URI specified on outbound registration '%s'\n",
ast_sorcery_object_get_id(applied));
return -1;
} else if (ast_sip_validate_uri_length(applied->client_uri)) {
ast_log(LOG_ERROR, "Client URI or hostname length exceeds pjpropject limit '%s'\n",
ast_sorcery_object_get_id(applied));
return -1;
} else if (applied->line && ast_strlen_zero(applied->endpoint)) {
ast_log(LOG_ERROR, "Line support has been enabled on outbound registration '%s' without providing an endpoint\n",
ast_sorcery_object_get_id(applied));