summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2005-06-18 20:51:59 +0000
committerTom Lane2005-06-18 20:51:59 +0000
commit41d28499a28249549d8f589370348479ff7232af (patch)
tree9e2b1219de902ca0967887f6bea05b00cf8390c9 /src/include
parent2b6dd51a5f85e904bc14f7ef00ea89fd003bdf1d (diff)
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.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/utils/hsearch.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h
index 05d26e9a150..d6f43163811 100644
--- a/src/include/utils/hsearch.h
+++ b/src/include/utils/hsearch.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: hsearch.h,v 1.29 2003/08/19 01:13:41 tgl Exp $
+ * $Id: hsearch.h,v 1.29.2.1 2005/06/18 20:51:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,6 +24,7 @@
typedef uint32 (*HashValueFunc) (const void *key, Size keysize);
typedef int (*HashCompareFunc) (const void *key1, const void *key2,
Size keysize);
+typedef void *(*HashCopyFunc) (void *dest, const void *src, Size keysize);
/*
* Space allocation function for a hashtable --- designed to match malloc().
@@ -108,6 +109,7 @@ typedef struct HTAB
* used */
char *tabname; /* table name (for error messages) */
bool isshared; /* true if table is in shared memory */
+ HashCopyFunc keycopy; /* key copying function */
} HTAB;
/* Parameter data structure for hash_create */