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)
committerDavid Mitchell <davem@iabyn.com>
Sun, 24 Feb 2013 20:27:17 +0000 (20:27 +0000)
commit7f5f08b152bb9d0c88efd1dd0f70d45e427efe1c
tree15f1db28adb968af1bb3cc373c4267cfc19b27da
parent623a911da450f8f4f1f400cb2c291c7898aecbd1
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