mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Use snprintf instead of sprintf in pg_regress.
To avoid static analyzers sounding the alarm, move to using snprintf
instead of sprintf. This was an oversight in 66d6086cbc.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/849588.1698179694@sss.pgh.pa.us
This commit is contained in:
@@ -845,7 +845,7 @@ initialize_environment(void)
|
|||||||
{
|
{
|
||||||
char s[16];
|
char s[16];
|
||||||
|
|
||||||
sprintf(s, "%d", port);
|
snprintf(s, sizeof(s), "%d", port);
|
||||||
setenv("PGPORT", s, 1);
|
setenv("PGPORT", s, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -867,7 +867,7 @@ initialize_environment(void)
|
|||||||
{
|
{
|
||||||
char s[16];
|
char s[16];
|
||||||
|
|
||||||
sprintf(s, "%d", port);
|
snprintf(s, sizeof(s), "%d", port);
|
||||||
setenv("PGPORT", s, 1);
|
setenv("PGPORT", s, 1);
|
||||||
}
|
}
|
||||||
if (user != NULL)
|
if (user != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user