Module: kamailio
Branch: master
Commit: 107dc767391902d5d3b000deecafb804c1c68c1b
URL:
https://github.com/kamailio/kamailio/commit/107dc767391902d5d3b000deecafb80…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-27T09:05:16+02:00
core: dns cache - avoid bitshifting with more than the size
- avoid undefined behaviour as per C specs
---
Modified: src/core/dns_cache.c
---
Diff:
https://github.com/kamailio/kamailio/commit/107dc767391902d5d3b000deecafb80…
Patch:
https://github.com/kamailio/kamailio/commit/107dc767391902d5d3b000deecafb80…
---
diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c
index 7f3e33875d..e8bfd7f5e6 100644
--- a/src/core/dns_cache.c
+++ b/src/core/dns_cache.c
@@ -2344,7 +2344,7 @@ inline static struct dns_rr* dns_srv_get_nxt_rr(struct
dns_hash_entry* e,
#endif
/* i is the winner */
*no=n; /* grp. start */
- srv_mark_tried(tried, i); /* mark it */
+ if(i<8*sizeof(*tried)) srv_mark_tried(tried, i); /* mark it */
return r_sums[i].rr;
no_more_rrs:
*no=n;