https://bugs.openldap.org/show_bug.cgi?id=10641
--- Comment #3 from Howard Chu hyc@openldap.org --- (In reply to Xiangfei Ding from comment #2)
so the length is still being checked.
I think the order matters. Without bound check coming first, under MSAN that is one assertion for you.
if ((dlen == cnlen-1) &&
Likewise, this is one check coming too late.
MSAN/ASAN are pointlessly pedantic here. No production server will ever fail due to a 1 byte overread past a 1 byte memory allocation because all normal (non-debugging) malloc libraries return 4- or 8-byte aligned memory (on 32 or 64 bit architectures).
The only reason we would fix something like this is to prevent meaningless bug reports like this from being filed in the future. Not because it in any way impacts the runtime behavior of any code.