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

Commit796a3f3

Browse files
committed
protect vfprintf from hijacking by Windows gettext just like other members of the *printf family.
1 parentc15de02 commit796a3f3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎src/include/port.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.105 2006/10/19 20:56:22 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.106 2006/11/28 01:12:33 adunstan Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -145,6 +145,9 @@ extern unsigned char pg_tolower(unsigned char ch);
145145
#ifdefsprintf
146146
#undef sprintf
147147
#endif
148+
#ifdefvfprintf
149+
#undef vfprintf
150+
#endif
148151
#ifdeffprintf
149152
#undef fprintf
150153
#endif
@@ -161,6 +164,7 @@ extern int
161164
pg_sprintf(char*str,constchar*fmt,...)
162165
/* This extension allows gcc to check the format string */
163166
__attribute__((format(printf,2,3)));
167+
externintpg_vfprintf(FILE*stream,constchar*fmt,va_listargs);
164168
externint
165169
pg_fprintf(FILE*stream,constchar*fmt,...)
166170
/* This extension allows gcc to check the format string */
@@ -179,12 +183,14 @@ __attribute__((format(printf, 1, 2)));
179183
#definevsnprintf(...)pg_vsnprintf(__VA_ARGS__)
180184
#definesnprintf(...)pg_snprintf(__VA_ARGS__)
181185
#definesprintf(...)pg_sprintf(__VA_ARGS__)
186+
#definevfprintf(...)pg_vfprintf(__VA_ARGS__)
182187
#definefprintf(...)pg_fprintf(__VA_ARGS__)
183188
#defineprintf(...)pg_printf(__VA_ARGS__)
184189
#else
185190
#definevsnprintfpg_vsnprintf
186191
#definesnprintfpg_snprintf
187192
#definesprintfpg_sprintf
193+
#definevfprintfpg_vfprintf
188194
#definefprintfpg_fprintf
189195
#defineprintfpg_printf
190196
#endif

‎src/port/snprintf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3232
* SUCH DAMAGE.
3333
*
34-
* $PostgreSQL: pgsql/src/port/snprintf.c,v 1.32 2006/10/04 00:30:14 momjian Exp $
34+
* $PostgreSQL: pgsql/src/port/snprintf.c,v 1.33 2006/11/28 01:12:34 adunstan Exp $
3535
*/
3636

3737
#include"c.h"
@@ -99,6 +99,7 @@
9999
#undefvsnprintf
100100
#undefsnprintf
101101
#undefsprintf
102+
#undefvfprintf
102103
#undeffprintf
103104
#undefprintf
104105

@@ -209,7 +210,7 @@ pg_sprintf(char *str, const char *fmt,...)
209210
returnlen;
210211
}
211212

212-
staticint
213+
int
213214
pg_vfprintf(FILE*stream,constchar*fmt,va_listargs)
214215
{
215216
PrintfTargettarget;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp