[OpenSIPS-Devel] [OpenSIPS/opensips] 17558c: mk_proxy(): Improve robustness
Liviu Chircu
noreply at github.com
Fri Aug 16 17:08:49 EDT 2019
Branch: refs/heads/master
Home: https://github.com/OpenSIPS/opensips
Commit: 17558c5bdac952899aee705a654725c786c6348f
https://github.com/OpenSIPS/opensips/commit/17558c5bdac952899aee705a654725c786c6348f
Author: Liviu Chircu <liviu at opensips.org>
Date: 2019-08-17 (Sat, 17 Aug 2019)
Changed paths:
M proxy.c
Log Message:
-----------
mk_proxy(): Improve robustness
A lot of code which calls mk_proxy() for DNS resolution assumes that
the "proxy->host->h_addr_list" array contains at least one value, e.g.:
modules/drouting/routing.c +611:
hostent2ip_addr(&pgw->ips[0], &proxy->host, proxy->addr_idx);
modules/dispatcher/dispatch.c +281:
hostent2ip_addr( &dp->ips[0], &proxy->host, proxy->addr_idx);
This would cause a segfault immediately if h_addr_list contains 0
results (i.e. first value is a NULL pointer). As the overall intention
is to resolve the hostname into at least 1 IP address, this patch
changes mk_proxy() to return NULL on a successful query with 0 results.
Credits to Jonathan Hulme for the report
More information about the Devel
mailing list