When using C-string lookup keys in a dynahash.c hash table, use strncpy()

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 558ff41f27da0d5a5fc9c0c9a6958bb32035b487
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2005-06-18T20:51:44Z
Releases: 8.0.4
When using C-string lookup keys in a dynahash.c hash table, use strncpy()
not memcpy() to copy the offered key into the hash table during HASH_ENTER.
This avoids possible core dump if the passed key is located very near the
end of memory.  Per report from Stefan Kaltenbrunner.

Files

PathChange+/−
src/backend/utils/hash/dynahash.c modified +10 −2
src/include/utils/hsearch.h modified +18 −6