summaryrefslogtreecommitdiff
path: root/channels/chan_rtp.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-12-21 17:54:42 -0600
committerRichard Mudgett <rmudgett@digium.com>2016-12-22 12:25:15 -0600
commit67b47191e9cc7f329d8a6803eb49f8cba8e68b1d (patch)
tree0e5499a2c3d2c1c4a5e61618b9d9d54267d8f84d /channels/chan_rtp.c
parent2fc65173e56910f72ca9a432290f49dd7a3aa82e (diff)
chan_rtp.c: Fix uninitialized memory crash.
unicast_rtp_request() could pass an uninitialized 'us' parameter to ast_ouraddrfor(). If ast_ouraddrfor() returns an error then the 'us' parameter may not get initialized. Thus when the code tries to save the 'us' parameter to the local address we could try to copy a ridiculous sized memory buffer and segfault. * Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort the UnicastRTP channel request if it fails. ASTERISK-26672 Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0
Diffstat (limited to 'channels/chan_rtp.c')
-rw-r--r--channels/chan_rtp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_rtp.c b/channels/chan_rtp.c
index 1c824fecc..6eec91e22 100644
--- a/channels/chan_rtp.c
+++ b/channels/chan_rtp.c
@@ -314,7 +314,12 @@ static struct ast_channel *unicast_rtp_request(const char *type, struct ast_form
engine_name = S_COR(ast_test_flag(&opts, OPT_RTP_ENGINE),
opt_args[OPT_ARG_RTP_ENGINE], "asterisk");
- ast_ouraddrfor(&address, &local_address);
+ ast_sockaddr_copy(&local_address, &address);
+ if (ast_ouraddrfor(&address, &local_address)) {
+ ast_log(LOG_ERROR, "Could not get our address for sending media to '%s'\n",
+ args.destination);
+ goto failure;
+ }
instance = ast_rtp_instance_new(engine_name, NULL, &local_address, NULL);
if (!instance) {
ast_log(LOG_ERROR,