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

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

Commit: 6a6f2d91d4e90d09d3b1606cc806f78944c235b3
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2005-06-18T20:51:30Z
Releases: 8.1.0
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 +12 −2
src/include/utils/hsearch.h modified +20 −6