When using C-string lookup keys in a dynahash.c hash table, use strncpy()
Tom Lane <tgl@sss.pgh.pa.us>
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
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/hash/dynahash.c | modified | +10 −2 |
| src/include/utils/hsearch.h | modified | +3 −1 |