Commit 7825f9b8 authored by Bruce Momjian's avatar Bruce Momjian

Fix for tprintf overruns from Göran Thyni.

parent ccbe540b
......@@ -108,7 +108,8 @@ tprintf(int flag, const char *fmt,...)
#ifdef ELOG_TIMESTAMPS
strcpy(line, tprintf_timestamp());
#endif
vsprintf(line + TIMESTAMP_SIZE, fmt, ap);
vsnprintf(line + TIMESTAMP_SIZE, ELOG_MAXLEN,
fmt, ap);
va_end(ap);
#ifdef USE_SYSLOG
......@@ -138,7 +139,8 @@ tprintf1(const char *fmt, ... )
#ifdef ELOG_TIMESTAMPS
strcpy(line, tprintf_timestamp());
#endif
vsprintf(line+TIMESTAMP_SIZE, fmt, ap);
vsnprintf(line+TIMESTAMP_SIZE, ELOG_MAXLEN,
fmt, ap);
va_end(ap);
#ifdef USE_SYSLOG
......@@ -166,7 +168,8 @@ eprintf(const char *fmt,...)
#ifdef ELOG_TIMESTAMPS
strcpy(line, tprintf_timestamp());
#endif
vsprintf(line + TIMESTAMP_SIZE, fmt, ap);
vsnprintf(line + TIMESTAMP_SIZE, ELOG_MAXLEN,
fmt, ap);
va_end(ap);
#ifdef USE_SYSLOG
......@@ -344,7 +347,8 @@ read_pg_options(SIGNAL_ARGS)
return;
}
sprintf(buffer, "%s/%s", DataDir, "pg_options");
snprintf(buffer, BUF_SIZE - 1,
"%s/%s", DataDir, "pg_options");
if ((fd = open(buffer, O_RDONLY)) < 0)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment