Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8015ba0

Browse files
committed
Prevent relname unallocated string length from being copied into database.
1 parent105889e commit8015ba0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎src/backend/commands/creatinh.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.6 1997/04/0203:57:06 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.7 1997/08/0219:09:33 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@ static void StoreCatalogInheritance(Oid relationId, List *supers);
4646
void
4747
DefineRelation(CreateStmt*stmt)
4848
{
49-
char*relname=stmt->relname;
49+
char*relname=palloc(NAMEDATALEN+1);
5050
List*schema=stmt->tableElts;
5151
intnumberOfAttributes;
5252
OidrelationId;
@@ -58,9 +58,10 @@ DefineRelation(CreateStmt *stmt)
5858

5959
char*typename=NULL;/* the typename of this relation. not useod for now */
6060

61-
if (strlen(relname)>NAMEDATALEN)
62-
elog(WARN,"the relation name %s is > %d characters long",relname,
61+
if (strlen(stmt->relname)>NAMEDATALEN)
62+
elog(WARN,"the relation name %s is > %d characters long",stmt->relname,
6363
NAMEDATALEN);
64+
strncpy(relname,stmt->relname,NAMEDATALEN+1);/* make full length for copy */
6465

6566
/* ----------------
6667
* Handle parameters

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp