git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 673a17e)
Use snprintf instead of sprintf in pg_regress.
2023年10月25日 08:53:11 +0000 (10:53 +0200)
2023年10月25日 08:53:11 +0000 (10:53 +0200)
To avoid static analyzers sounding the alarm, move to using snprintf
instead of sprintf. This was an oversight in 66d6086cbcbfc8dee789a6.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/849588.1698179694@sss.pgh.pa.us


diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index b0af751c92ed1727a2d201c20e004f6e59ac8626..b35e87295e3a9958b07a05136b9f00dddb3ef034 100644 (file)
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -845,7 +845,7 @@ initialize_environment(void)
{
char s[16];
- sprintf(s, "%d", port);
+ snprintf(s, sizeof(s), "%d", port);
setenv("PGPORT", s, 1);
}
}
@@ -867,7 +867,7 @@ initialize_environment(void)
{
char s[16];
- sprintf(s, "%d", port);
+ snprintf(s, sizeof(s), "%d", port);
setenv("PGPORT", s, 1);
}
if (user != NULL)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /