Commit Graph

29401 Commits

Author SHA1 Message Date
Jenkins2
bcd2241c47 Merge "res_pjsip_pubsub: Ensure remote URI contains URI only." into 13 2017-11-13 06:32:28 -06:00
Richard Mudgett
bb2173275a frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant
Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793
2017-11-11 13:03:31 -06:00
Jenkins2
1250b7c664 Merge "chan_pjsip.c: Fix uninitialized cause value on failure." into 13 2017-11-10 08:18:04 -06:00
Corey Farrell
211f5d8dd4 core: Remove disabled code.
handle_quit has been disabled since 2003, remove it.

Change-Id: Idc3aaa6c81676160547078f9b71e8aa43de2db18
2017-11-09 21:38:11 -05:00
Jenkins2
6cce744401 Merge "stasis_bridges.c: Fix off-nominal json memory leaks." into 13 2017-11-09 17:44:16 -06:00
Kevin Harwell
e3bc8f7815 Merge "res_pjsip_registrar.c: Fix named AOR and pjproject group deadlock." into 13 2017-11-09 11:48:50 -06:00
Richard Mudgett
32042c6c3c chan_pjsip.c: Fix uninitialized cause value on failure.
Change-Id: I3f9dd3c31bd582e54a30381500077de2319d8cc3
2017-11-09 07:39:59 -06:00
Joshua Colp
7296d3e5af Merge "res_pjsip_history: Fix multiple leaks on vector append failure." into 13 2017-11-09 03:44:21 -06:00
Jenkins2
88d3773330 Merge "res_pjsip_pubsub: Fix multiple leaks on failure to append vectors." into 13 2017-11-08 20:56:26 -06:00
George Joseph
67d12d1437 Merge "AST-2017-009: pjproject: Add validation of numeric header values" into 13 2017-11-08 09:52:22 -06:00
George Joseph
62e70c70a5 Merge "AST-2017-011 - res_pjsip_session: session leak when a call is rejected" into 13 2017-11-08 09:44:40 -06:00
George Joseph
b2fbf1afd7 Merge "AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun" into 13 2017-11-08 08:26:10 -06:00
Jenkins2
936a85419e Merge "res_pjproject.c: Fix ast_strdup() alloc failure." into 13 2017-11-08 07:06:15 -06:00
Jenkins2
cdafec0f7a Merge "res_pjsip_outbound_registration: Fix leak on vector add failure." into 13 2017-11-08 07:03:37 -06:00
Kevin Harwell
4b3e03ae87 AST-2017-011 - res_pjsip_session: session leak when a call is rejected
A previous commit made it so when an invite session transitioned into a
disconnected state destruction of the Asterisk pjsip session object was
postponed until either a transport error occurred or the event timer
expired. However, if a call was rejected (for instance a 488) before the
session was fully established the event timer may not have been initiated,
or it was canceled without triggering either of the session finalizing states
mentioned above.

Really the only time destruction of the session should be delayed is when a
BYE is being transacted. This is because it's possible in some cases for the
session to be disconnected, but the BYE is still transacting.

This patch makes it so the session object always gets released (no more
memory leak) when the pjsip session is in a disconnected state. Except when
the method is a BYE. Then it waits until a transport error occurs or an event
timeout.

ASTERISK-27345 #close

Reported by: Corey Farrell

Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed
2017-11-08 05:46:37 -07:00
Richard Mudgett
2b85799512 AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun
cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if
the supplied string is too long.  The long string could be supplied by
external means using the CDR(userfield) function.

This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is.  The
earlier patch fixed the buffer overrun for Party A's userfield while this
patch fixes the same thing for Party B's userfield.

ASTERISK-27337

Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652
2017-11-08 05:37:52 -07:00
George Joseph
2faa3e3bab AST-2017-009: pjproject: Add validation of numeric header values
Parsing the numeric header fields like cseq, ttl, port, etc. all
had the potential to overflow, either causing unintended values to
be captured or, if the values were subsequently converted back to
strings, a buffer overrun.  To address this, new "strto" functions
have been created that do range checking and those functions are
used wherever possible in the parser.

 * Created pjlib/include/limits.h and pjlib/include/compat/limits.h
   to either include the system limits.h or define common numeric
   limits if there is no system limits.h.

 * Created strto*_validate functions in sip_parser that take bounds
   and on failure call the on_str_parse_error function which prints
   an error message and calls PJ_THROW.

 * Updated sip_parser to validate the numeric fields.

 * Fixed an issue in sip_transport that prevented error messages
   from being properly displayed.

 * Added "volatile" to some variables referenced in PJ_CATCH blocks
   as the optimizer was sometimes optimizing them away.

 * Fixed length calculation in sip_transaction/create_tsx_key_2543
   to account for signed ints being 11 characters, not 9.

ASTERISK-27319
Reported by: Youngsung Kim at LINE Corporation

Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff
2017-11-08 05:21:26 -07:00
Joshua Colp
4e8271c2a5 Merge "res_stasis: Fix multiple leaks." into 13 2017-11-08 04:59:15 -06:00
Jenkins2
fe78531d5e Merge "res_pjsip_config_wizard: Fix leaks and add check for malloc failure." into 13 2017-11-07 22:48:08 -06:00
Corey Farrell
16df0e9786 res_pjsip_pubsub: Fix multiple leaks on failure to append vectors.
Change-Id: I68ece0073ea79667ca41eb10405f516f1d30d482
2017-11-07 22:38:04 -05:00
Corey Farrell
cf91dde509 res_pjsip_history: Fix multiple leaks on vector append failure.
Change-Id: I41e8d5183ace284095cc721f3b1fb32ade3f940f
2017-11-07 22:31:07 -05:00
Jenkins2
5c47ee4476 Merge "res_pjsip: Fix leak on error in ast_sip_auth_vector_init." into 13 2017-11-07 17:38:38 -06:00
Jenkins2
34065994fe Merge "test_sorcery_memory_cache_thrash: Handle error from vector append." into 13 2017-11-07 16:48:42 -06:00
Jenkins2
841fc3e5c2 Merge "stasis: Release object if vector append fails." into 13 2017-11-07 16:11:13 -06:00
Joshua Colp
7657519a53 Merge "format_cap: Fix leak on AST_VECTOR_APPEND error." into 13 2017-11-07 14:32:15 -06:00
Joshua Colp
5a60ce3ee3 Merge "Messaging: Report error on failure to register tech or handler." into 13 2017-11-07 14:31:59 -06:00
Jenkins2
cb1ec6255f Merge "CLI: Remove unused internal command." into 13 2017-11-07 12:47:42 -06:00
Joshua Colp
40f906add4 Merge "res_pjsip: Avoid crash when contact uri is empty string" into 13 2017-11-07 12:04:41 -06:00
Richard Mudgett
7ad4c19b20 res_pjsip_registrar.c: Fix named AOR and pjproject group deadlock.
One of the patches for ASTERISK_27147 introduced a deadlock regression.
When the connection oriented transport shut down, the code attempted to
remove the associated contact.  However, that same transport had just
requested a registration that we hadn't responded to yet.  Depending
upon timing we could deadlock.

* Made send the REGISTER response after we completed processing the
request contacts and released the named AOR lock to avoid the deadlock.

ASTERISK-27391

Change-Id: I89a90f87cb7a02facbafb44c75d8845f93417364
2017-11-07 12:00:24 -06:00
Jenkins2
8824ed44dc Merge "res_pjsip: Ignore empty TLS configuration" into 13 2017-11-07 10:29:42 -06:00
Corey Farrell
c1a608f862 res_stasis: Fix multiple leaks.
* res/stasis/app.c JSON passed to app_send needs to be released.
* res/stasis_message.c: objects leak if vector append fails.

Change-Id: I8dd5385b9f50a5cadf2b1d16efecffd6ddb4db4a
2017-11-07 11:24:51 -05:00
Joshua Colp
5d19dc2cb1 Merge "tcptls: Print notice when TLS is enabled but not configured." into 13 2017-11-07 09:42:34 -06:00
Aaron An
d95bfcd013 res_pjsip: Avoid crash when contact uri is empty string
Asterisk will crash if contact uri is invalid, so contact_apply_handler
should check if the uri is NULL or empty.

ASTERISK-27393 #close
Reported-by: Aaron An
Tested-by: AaronAn

Change-Id: Ia0309bdc6b697c73c9c736e1caec910b77ca69f5
2017-11-07 10:33:06 -05:00
Joshua Colp
315ccf40f4 Merge "stasis: Remove silly use of RAII_VAR in stasis_forward_all." into 13 2017-11-07 08:52:39 -06:00
Jenkins2
ec40b74e51 Merge "stasis_channels.c: Remove a very silly RAII_VAR()." into 13 2017-11-07 08:09:07 -06:00
Jenkins2
01064bd6bc Merge "stasis/app.c: Optimize stasis_app_get_debug_by_name()" into 13 2017-11-07 07:32:58 -06:00
Richard Mudgett
ec58521a48 res_pjproject.c: Fix ast_strdup() alloc failure.
Change-Id: I74688038e7afe3a279359cce53aadb28ade51ead
2017-11-07 07:10:27 -06:00
Jenkins2
37863c163c Merge "Fix ast_(v)asprintf() malloc failure usage conditions." into 13 2017-11-07 06:41:50 -06:00
Jenkins2
36b5a66c27 Merge "RTP Engine: Deal with errors returned from AST_VECTOR_REPLACE." into 13 2017-11-07 06:06:01 -06:00
Corey Farrell
69af7eb663 res_pjsip_outbound_registration: Fix leak on vector add failure.
Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46
2017-11-06 18:56:33 -05:00
Corey Farrell
4f75655cb6 res_pjsip_config_wizard: Fix leaks and add check for malloc failure.
wizard_apply_handler():
- Free host if we fail to add it to the vector.

wizard_mapped_observer():
- Check for otw allocation failure.
- Free otw if we fail to add it to the vector.

Change-Id: Ib5d3bcabbd9c24dd8a3c9cc692a794a5f60243ad
2017-11-06 18:46:54 -05:00
Corey Farrell
8cdc0ef385 test_sorcery_memory_cache_thrash: Handle error from vector append.
Cleanup resources when we fail to append the vector and report test
failure.

Change-Id: I6eb41586fd11dee8c0dfe35e91cb465a4cab7298
2017-11-06 18:35:27 -05:00
Corey Farrell
e4fba95022 res_pjsip: Fix leak on error in ast_sip_auth_vector_init.
Change-Id: Ib0fc7a18f3135ca8990c3984c9e15f6d26e556e8
2017-11-06 18:31:51 -05:00
Corey Farrell
b96dd55add res_pjproject: Handle error from adding to the buildopts vector.
Change-Id: I076c7bd207c7989a23005395ce1735392657be65
2017-11-06 18:20:25 -05:00
Corey Farrell
3dc600ef84 stasis: Release object if vector append fails.
Change-Id: I3e5cc669169aab6175ddfaf7486edeaeb4fdcfb1
2017-11-06 16:36:55 -05:00
Corey Farrell
fc041554c3 RTP Engine: Deal with errors returned from AST_VECTOR_REPLACE.
Check for errors from AST_VECTOR_REPLACE and clean memory if needed.

Change-Id: I124d15cc1d645f85a72a1279f623c1993b304b0b
2017-11-06 16:30:10 -05:00
Corey Farrell
75539dbf2c Messaging: Report error on failure to register tech or handler.
Message tech and handler registrations use a vector which could fail to
expand.  If it does log and error and return error.

Change-Id: I593a8de81a07fb0452e9b0efd5d4018b77bca6f4
2017-11-06 16:13:58 -05:00
Corey Farrell
b4240bea6c format_cap: Fix leak on AST_VECTOR_APPEND error.
format_cap_framed_init can fail on AST_VECTOR_APPEND.  This should
report failure to the caller and clean the newly allocated frame.

Change-Id: Ica0661235bf09497bf23d844ceb01f21b41a55b0
2017-11-06 16:12:12 -05:00
Corey Farrell
803dc3dee5 stasis: Remove silly use of RAII_VAR in stasis_forward_all.
Change-Id: I46de4c968d40144d5b049966304ff66c1469fb65
2017-11-06 15:24:57 -05:00
Corey Farrell
0a0e2c4253 CLI: Remove unused internal command.
The internal CLI command "_command complete" was last used by Asterisk
0.2.0.  Since then we've been using "_command nummatches" and "_command
matchesarray".

Change-Id: I682fe1e21a24a3bb5bd04146e639f1c5866bcfce
2017-11-06 13:51:50 -05:00