Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7825f9b

Browse files
committed
Fix for tprintf overruns from Göran Thyni.
1 parentccbe540 commit7825f9b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/utils/misc/trace.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ tprintf(int flag, const char *fmt,...)
108108
#ifdefELOG_TIMESTAMPS
109109
strcpy(line,tprintf_timestamp());
110110
#endif
111-
vsprintf(line+TIMESTAMP_SIZE,fmt,ap);
111+
vsnprintf(line+TIMESTAMP_SIZE,ELOG_MAXLEN,
112+
fmt,ap);
112113
va_end(ap);
113114

114115
#ifdefUSE_SYSLOG
@@ -138,7 +139,8 @@ tprintf1(const char *fmt, ... )
138139
#ifdefELOG_TIMESTAMPS
139140
strcpy(line,tprintf_timestamp());
140141
#endif
141-
vsprintf(line+TIMESTAMP_SIZE,fmt,ap);
142+
vsnprintf(line+TIMESTAMP_SIZE,ELOG_MAXLEN,
143+
fmt,ap);
142144
va_end(ap);
143145

144146
#ifdefUSE_SYSLOG
@@ -166,7 +168,8 @@ eprintf(const char *fmt,...)
166168
#ifdefELOG_TIMESTAMPS
167169
strcpy(line,tprintf_timestamp());
168170
#endif
169-
vsprintf(line+TIMESTAMP_SIZE,fmt,ap);
171+
vsnprintf(line+TIMESTAMP_SIZE,ELOG_MAXLEN,
172+
fmt,ap);
170173
va_end(ap);
171174

172175
#ifdefUSE_SYSLOG
@@ -344,7 +347,8 @@ read_pg_options(SIGNAL_ARGS)
344347
return;
345348
}
346349

347-
sprintf(buffer,"%s/%s",DataDir,"pg_options");
350+
snprintf(buffer,BUF_SIZE-1,
351+
"%s/%s",DataDir,"pg_options");
348352
if ((fd=open(buffer,O_RDONLY))<0)
349353
return;
350354

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp