Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8f0fd47

Browse files
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 66d6086. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/849588.1698179694@sss.pgh.pa.us
1 parent 673a17e commit 8f0fd47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/regress/pg_regress.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ initialize_environment(void)
845845
{
846846
char s[16];
847847

848-
sprintf(s, "%d", port);
848+
snprintf(s, sizeof(s), "%d", port);
849849
setenv("PGPORT", s, 1);
850850
}
851851
}
@@ -867,7 +867,7 @@ initialize_environment(void)
867867
{
868868
char s[16];
869869

870-
sprintf(s, "%d", port);
870+
snprintf(s, sizeof(s), "%d", port);
871871
setenv("PGPORT", s, 1);
872872
}
873873
if (user != NULL)

0 commit comments

Comments
 (0)