aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/misc/guc.c4
-rw-r--r--src/common/psprintf.c4
-rw-r--r--src/port/snprintf.c13
3 files changed, 13 insertions, 8 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 03594e77fee..380741e6480 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -4387,7 +4387,7 @@ static struct config_enum ConfigureNamesEnum[] =
},
&ssl_min_protocol_version,
PG_TLS1_VERSION,
- ssl_protocol_versions_info + 1 /* don't allow PG_TLS_ANY */,
+ ssl_protocol_versions_info + 1, /* don't allow PG_TLS_ANY */
NULL, NULL, NULL
},
@@ -9666,7 +9666,7 @@ do_serialize(char **destptr, Size *maxbytes, const char *fmt,...)
if (n < 0)
{
/* Shouldn't happen. Better show errno description. */
- elog(ERROR, "vsnprintf failed: %m");
+ elog(ERROR, "vsnprintf failed: %m with format string \"%s\"", fmt);
}
if (n >= *maxbytes)
{
diff --git a/src/common/psprintf.c b/src/common/psprintf.c
index 2cf100f0954..411713bac84 100644
--- a/src/common/psprintf.c
+++ b/src/common/psprintf.c
@@ -113,9 +113,9 @@ pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
if (unlikely(nprinted < 0))
{
#ifndef FRONTEND
- elog(ERROR, "vsnprintf failed: %m");
+ elog(ERROR, "vsnprintf failed: %m with format string \"%s\"", fmt);
#else
- fprintf(stderr, "vsnprintf failed: %s\n", strerror(errno));
+ fprintf(stderr, "vsnprintf failed: %m with format string \"%s\"\n", fmt);
exit(EXIT_FAILURE);
#endif
}
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index c79cb884972..a7733816172 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -452,8 +452,6 @@ dopr(PrintfTarget *target, const char *format, va_list args)
have_star = afterstar = false;
nextch2:
ch = *format++;
- if (ch == '\0')
- break; /* illegal, but we don't complain */
switch (ch)
{
case '-':
@@ -718,6 +716,13 @@ nextch2:
case '%':
dopr_outch('%', target);
break;
+ default:
+
+ /*
+ * Anything else --- in particular, '\0' indicating end of
+ * format string --- is bogus.
+ */
+ goto bad_format;
}
/* Check for failure after each conversion spec */
@@ -782,8 +787,6 @@ find_arguments(const char *format, va_list args,
afterstar = false;
nextch1:
ch = *format++;
- if (ch == '\0')
- break; /* illegal, but we don't complain */
switch (ch)
{
case '-':
@@ -918,6 +921,8 @@ nextch1:
case 'm':
case '%':
break;
+ default:
+ return false; /* bogus format string */
}
/*