This simple patch to catalog/pg_type.c fixes a buffer overrun. It

was detected by Electric Fence and triggered by statements like:

	SELECT * into table t from pg_database;

The system would crash on a memmove call in DataFile() with arguments
like this:

	memmove(0x0, 0x0, 0);

Maurice Gittens
This commit is contained in:
Bruce Momjian 1998-03-30 17:46:45 +00:00
parent dbf34c5c19
commit ef0eecfa1f
1 changed files with 4 additions and 2 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.20 1998/02/26 04:30:45 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.21 1998/03/30 17:46:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -318,6 +318,7 @@ TypeCreate(char *typeName,
TupleDesc tupDesc;
Oid argList[8];
NameData name;
static ScanKeyData typeKey[1] = {
@ -387,7 +388,8 @@ TypeCreate(char *typeName,
* ----------------
*/
i = 0;
values[i++] = PointerGetDatum(typeName); /* 1 */
namestrcpy(&name,typeName);
values[i++] = NameGetDatum(&name); /* 1 */
values[i++] = (Datum) GetUserId(); /* 2 */
values[i++] = (Datum) internalSize; /* 3 */
values[i++] = (Datum) externalSize; /* 4 */