mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-29 23:39:35 +00:00 
			
		
		
		
	Fix a bug where we were passing in address information that should remain unmodified to a function that may modify it.
(closes issue #15243) Reported by: pj git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -278,6 +278,7 @@ int ast_rtp_instance_destroy(struct ast_rtp_instance *instance) | |||||||
|  |  | ||||||
| struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct sched_context *sched, struct sockaddr_in *sin, void *data) | struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct sched_context *sched, struct sockaddr_in *sin, void *data) | ||||||
| { | { | ||||||
|  | 	struct sockaddr_in address = { 0, }; | ||||||
| 	struct ast_rtp_instance *instance = NULL; | 	struct ast_rtp_instance *instance = NULL; | ||||||
| 	struct ast_rtp_engine *engine = NULL; | 	struct ast_rtp_engine *engine = NULL; | ||||||
|  |  | ||||||
| @@ -315,11 +316,12 @@ struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct sc | |||||||
| 	instance->local_address.sin_family = AF_INET; | 	instance->local_address.sin_family = AF_INET; | ||||||
| 	instance->local_address.sin_addr = sin->sin_addr; | 	instance->local_address.sin_addr = sin->sin_addr; | ||||||
| 	instance->remote_address.sin_family = AF_INET; | 	instance->remote_address.sin_family = AF_INET; | ||||||
|  | 	address.sin_addr = sin->sin_addr; | ||||||
|  |  | ||||||
| 	ast_debug(1, "Using engine '%s' for RTP instance '%p'\n", engine->name, instance); | 	ast_debug(1, "Using engine '%s' for RTP instance '%p'\n", engine->name, instance); | ||||||
|  |  | ||||||
| 	/* And pass it off to the engine to setup */ | 	/* And pass it off to the engine to setup */ | ||||||
| 	if (instance->engine->new(instance, sched, sin, data)) { | 	if (instance->engine->new(instance, sched, &address, data)) { | ||||||
| 		ast_debug(1, "Engine '%s' failed to setup RTP instance '%p'\n", engine->name, instance); | 		ast_debug(1, "Engine '%s' failed to setup RTP instance '%p'\n", engine->name, instance); | ||||||
| 		ao2_ref(instance, -1); | 		ao2_ref(instance, -1); | ||||||
| 		return NULL; | 		return NULL; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user