summaryrefslogtreecommitdiff
path: root/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
commite804725e7535dfe1dbb45ae560e800a2e242084f (patch)
tree9c54ef34a51bfcbbc3909c889608a5f1bcc5b585 /bitncmp.c
parentec11480d8b4da758263b187ba81a54f08aa883a0 (diff)
downloadc-ares-e804725e7535dfe1dbb45ae560e800a2e242084f.tar.gz
c-ares-e804725e7535dfe1dbb45ae560e800a2e242084f.tar.bz2
c-ares-e804725e7535dfe1dbb45ae560e800a2e242084f.zip
Fix potential out-of-bounds read
Diffstat (limited to 'bitncmp.c')
-rw-r--r--bitncmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitncmp.c b/bitncmp.c
index b9077ba..3089186 100644
--- a/bitncmp.c
+++ b/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];