1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

This patches replaces a few more usages of strcpy() and sprintf() when

copying into a fixed-size buffer (in this case, a buffer of
NAMEDATALEN bytes). AFAICT nothing to worry about here, but worth
fixing anyway...

Neil Conway
This commit is contained in:
Bruce Momjian
2002-08-27 03:56:35 +00:00
parent e0a77f56e3
commit dd912c6977
5 changed files with 18 additions and 18 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.242 2002/08/19 19:33:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.243 2002/08/27 03:56:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -665,7 +665,7 @@ CreateIndexName(char *table_name, char *column_name,
* indexes, only among the indexes we're about to create now; this
* ought to be improved someday.
*/
strcpy(typename, label);
strncpy(typename, label, sizeof(typename));
for (;;)
{
@ -685,7 +685,7 @@ CreateIndexName(char *table_name, char *column_name,
/* found a conflict, so try a new name component */
pfree(iname);
sprintf(typename, "%s%d", label, ++pass);
snprintf(typename, sizeof(typename), "%s%d", label, ++pass);
}
return iname;