summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2014-10-24 03:28:05 +0000
committerNanang Izzuddin <nanang@teluu.com>2014-10-24 03:28:05 +0000
commitf190165c8f0660bb483d007996021f029b9931cb (patch)
tree429e39d36f02f9dcc7929820c597e2f0771b0ea6 /pjsip
parent9742db74351dd1533dc62fee99d2027cb4f81207 (diff)
Fix #1800: Fixed crash in SIP resolver when DNS server return a lot of addresses (> PJSIP_MAX_RESOLVED_ADDRESSES).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4954 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsip/sip_resolve.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pjsip/src/pjsip/sip_resolve.c b/pjsip/src/pjsip/sip_resolve.c
index fb23b538..03413ab8 100644
--- a/pjsip/src/pjsip/sip_resolve.c
+++ b/pjsip/src/pjsip/sip_resolve.c
@@ -453,7 +453,9 @@ static void dns_a_callback(void *user_data,
/* Build server addresses and call callback */
srv.count = 0;
- for (i=0; i<rec.addr_count; ++i) {
+ for (i = 0; i < rec.addr_count &&
+ srv.count < PJSIP_MAX_RESOLVED_ADDRESSES; ++i)
+ {
srv.entry[srv.count].type = query->naptr[0].type;
srv.entry[srv.count].priority = 0;
srv.entry[srv.count].weight = 0;
@@ -498,7 +500,9 @@ static void srv_resolver_cb(void *user_data,
for (i=0; i<rec->count; ++i) {
unsigned j;
- for (j=0; j<rec->entry[i].server.addr_count; ++j) {
+ for (j = 0; j < rec->entry[i].server.addr_count &&
+ srv.count < PJSIP_MAX_RESOLVED_ADDRESSES; ++j)
+ {
srv.entry[srv.count].type = query->naptr[0].type;
srv.entry[srv.count].priority = rec->entry[i].priority;
srv.entry[srv.count].weight = rec->entry[i].weight;