sdbm.c: fix off-by-one access to global ".dir"
authorReini Urban <rurban@x-ray.at>
Fri, 9 Mar 2012 15:11:50 +0000 (09:11 -0600)
committerCraig A. Berry <craigberry@mac.com>
Fri, 9 Mar 2012 15:11:50 +0000 (09:11 -0600)
commitacdbe25bd91bf897e0cf373b91ab0814e21c4860
tree3495e0a4a1c4d2d7bfcb19cc1575c5abec796009
parenta752ff79ee1321f459c659136b0f0e7e43e1f5ae
sdbm.c: fix off-by-one access to global ".dir"

Detected by clang -faddress-sanitizer.

The bug came in 081f72ad6fa2b76e0b3cd9046371b2dbd9130114, where
we started calculating lengths with sizeof on string constants
instead of using strlen.  Since string constants include the null
byte, sizeof(".dir"), for example, is 5, but we've been copying 6
bytes.

This patch resolves [perl #111586] and includes revisions by the
committer.
ext/SDBM_File/sdbm/sdbm.c