[sr-dev] git:master:107dc767: core: dns cache - avoid bitshifting with more than the size
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jul 27 09:16:04 CEST 2017
Module: kamailio
Branch: master
Commit: 107dc767391902d5d3b000deecafb804c1c68c1b
URL: https://github.com/kamailio/kamailio/commit/107dc767391902d5d3b000deecafb804c1c68c1b
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/107dc767391902d5d3b000deecafb804c1c68c1b.diff
Patch: https://github.com/kamailio/kamailio/commit/107dc767391902d5d3b000deecafb804c1c68c1b.patch
---
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;
More information about the sr-dev
mailing list