]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[BUG] ebtree: fix ebmb_lookup() with len smaller than the tree's keys
authorWilly Tarreau <w@1wt.eu>
Tue, 4 Jan 2011 12:21:06 +0000 (13:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 4 Jan 2011 13:43:49 +0000 (14:43 +0100)
commit414c4b21465f82f1438c06cb4b63806a93923f65
tree44d87e95cb5d915fef0b1ad81e4fa9bed1f7b097
parentf18b5f21bafef909901b7b5cf95625a63e609c75
[BUG] ebtree: fix ebmb_lookup() with len smaller than the tree's keys

(from ebtree 6.0.5)

ebmb_lookup() is used by ebst_lookup_len() to lookup a string starting
with a known substring. Since the substring does not necessarily end
with a zero, we must absolutely ensure that the comparison stops at
<len> bytes, otherwise we can end up comparing crap and most often
returning the wrong node in case of multiple matches.

ebim_lookup() was fixed too by resyncing it with ebmb_lookup().
(cherry picked from commit 98eba315aa2c3285181375d312bcb770f058fd2b)

This should be backported to 1.4 though it's not critical there.
ebtree/ebimtree.h
ebtree/ebmbtree.h