mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Some security, since we now have vsnprintf, I remade an old patch
with some extra ugly sprintfs fixed. More work in this area is needed still. Göran Thyni
This commit is contained in:
@ -108,7 +108,7 @@ 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 +138,7 @@ 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 +166,7 @@ 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 +344,7 @@ 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;
|
||||
|
||||
|
Reference in New Issue
Block a user