aboutsummaryrefslogtreecommitdiff
path: root/ares/bitncmp.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-10-10 12:31:27 +0000
committerYang Tse <yangsita@gmail.com>2009-10-10 12:31:27 +0000
commit4d9279cb3b88e243d304fa9687fcc1cb146a1dcc (patch)
treec8bbc214cd3a48197ceacc975f08fdbc945b1e3a /ares/bitncmp.c
parent640e49976f34d766124cb6988dc4849c4acab6d0 (diff)
Fix potential out-of-bounds read
Diffstat (limited to 'ares/bitncmp.c')
-rw-r--r--ares/bitncmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ares/bitncmp.c b/ares/bitncmp.c
index b9077bacc..30891861f 100644
--- a/ares/bitncmp.c
+++ b/ares/bitncmp.c
@@ -41,7 +41,7 @@ ares_bitncmp(const void *l, const void *r, int n) {
b = n / 8;
x = memcmp(l, r, b);
- if (x)
+ if (x || (n % 8) == 0)
return (x);
lb = ((const unsigned char *)l)[b];