Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 95c9c22

Browse files
committed
Fix a dozen or so places that were passing unpredictable data strings
as elog format strings. Hai-Chen Tu pointed out the problem in contrib/dbmirror, but it wasn't the only such error.
1 parent eeec0a6 commit 95c9c22

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

contrib/cube/cubeparse.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ int cube_yyerror ( char *msg ) {
200200
);
201201

202202
reset_parse_buffer();
203-
elog(ERROR, buf);
203+
elog(ERROR, "%s", buf);
204204
return 0;
205205
}
206206

contrib/dbmirror/pending.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
* pending.c
3-
* $Id: pending.c,v 1.8 2002/11/22 16:04:41 momjian Exp $
3+
* $Id: pending.c,v 1.9 2002/11/22 16:25:29 tgl Exp $
44
*
55
* This file contains a trigger for Postgresql-7.x to record changes to tables
66
* to a pending table for mirroring.
@@ -253,7 +253,7 @@ storeKeyInfo(char *cpTableName, HeapTuple tTupleData,
253253
return -1;
254254
}
255255
#if defined DEBUG_OUTPUT
256-
elog(NOTICE, "%s", cpKeyData);
256+
elog(NOTICE, "KeyData: %s", cpKeyData);
257257
#endif
258258
saPlanData[0] = PointerGetDatum(cpKeyData);
259259

@@ -268,7 +268,7 @@ storeKeyInfo(char *cpTableName, HeapTuple tTupleData,
268268
return -1;
269269
}
270270
#if defined DEBUG_OUTPUT
271-
elog(NOTICE, "INSERT SUCCESFULL");
271+
elog(NOTICE, "Insert successful");
272272
#endif
273273

274274
return 0;
@@ -351,7 +351,7 @@ storeData(char *cpTableName, HeapTuple tTupleData, TupleDesc tTupleDesc,
351351
return -1;
352352
}
353353
#if defined DEBUG_OUTPUT
354-
elog(NOTICE, "INSERT SUCCESFULL");
354+
elog(NOTICE, "Insert successful");
355355
#endif
356356

357357
return 0;
@@ -437,7 +437,7 @@ packageData(HeapTuple tTupleData, TupleDesc tTupleDesc,
437437
cpFieldName = DatumGetPointer(NameGetDatum(&tTupleDesc->attrs
438438
[iColumnCounter - 1]->attname));
439439
#if defined DEBUG_OUTPUT
440-
elog(NOTICE, "%s", cpFieldName);
440+
elog(NOTICE, "FieldName: %s", cpFieldName);
441441
#endif
442442
while (iDataBlockSize - iUsedDataBlock < strlen(cpFieldName) + 6)
443443
{
@@ -465,7 +465,7 @@ packageData(HeapTuple tTupleData, TupleDesc tTupleDesc,
465465

466466
}
467467
#if defined DEBUG_OUTPUT
468-
elog(NOTICE, "%s", cpFieldData);
468+
elog(NOTICE, "FieldData: %s", cpFieldData);
469469
elog(NOTICE, "Starting format loop");
470470
#endif
471471
while (*cpUnFormatedPtr != 0)
@@ -499,7 +499,7 @@ packageData(HeapTuple tTupleData, TupleDesc tTupleDesc,
499499
sprintf(cpFormatedPtr, "' ");
500500
iUsedDataBlock = iUsedDataBlock + 2;
501501
#if defined DEBUG_OUTPUT
502-
elog(NOTICE, "%s", cpDataBlock);
502+
elog(NOTICE, "DataBlock: %s", cpDataBlock);
503503
#endif
504504

505505
} /* for iColumnCounter */

contrib/rserv/rserv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ _rserv_log_()
132132
GetCurrentTransactionId(), deleted, rel->rd_id, okey);
133133

134134
if (debug)
135-
elog(DEBUG3, sql);
135+
elog(DEBUG3, "sql: %s", sql);
136136

137137
ret = SPI_exec(sql, 0);
138138

@@ -153,7 +153,7 @@ _rserv_log_()
153153
deleted, okey);
154154

155155
if (debug)
156-
elog(DEBUG3, sql);
156+
elog(DEBUG3, "sql: %s", sql);
157157

158158
ret = SPI_exec(sql, 0);
159159

@@ -177,7 +177,7 @@ _rserv_log_()
177177
rel->rd_id, GetCurrentTransactionId(), okey);
178178

179179
if (debug)
180-
elog(DEBUG3, sql);
180+
elog(DEBUG3, "sql: %s", sql);
181181

182182
ret = SPI_exec(sql, 0);
183183

contrib/seg/segparse.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ float seg_atof ( char *value ) {
144144
if ( errno ) {
145145
snprintf(buf, 256, "numeric value %s unrepresentable", value);
146146
reset_parse_buffer();
147-
elog(ERROR, buf);
147+
elog(ERROR, "%s", buf);
148148
}
149149

150150
return result;
@@ -175,7 +175,7 @@ int seg_yyerror ( char *msg ) {
175175
);
176176

177177
reset_parse_buffer();
178-
elog(ERROR, buf);
178+
elog(ERROR, "%s", buf);
179179
return 0;
180180
}
181181

src/pl/plpython/plpython.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
3030
*
3131
* IDENTIFICATION
32-
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.26 2002/10/19 22:10:58 tgl Exp $
32+
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.27 2002/11/22 16:25:30 tgl Exp $
3333
*
3434
*********************************************************************
3535
*/
@@ -2733,7 +2733,7 @@ PLy_output(volatile int level, PyObject * self, PyObject * args)
27332733
RERAISE_EXC();
27342734
}
27352735

2736-
elog(level, sv);
2736+
elog(level, "%s", sv);
27372737

27382738
RESTORE_EXC();
27392739

src/pl/tcl/pltcl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.66 2002/10/19 22:10:58 tgl Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.67 2002/11/22 16:25:32 tgl Exp $
3535
*
3636
**********************************************************************/
3737

@@ -1303,7 +1303,7 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
13031303
* and return to the caller (if not catched)
13041304
************************************************************/
13051305
UTF_BEGIN;
1306-
elog(level, UTF_U2E(argv[2]));
1306+
elog(level, "%s", UTF_U2E(argv[2]));
13071307
UTF_END;
13081308
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
13091309
return TCL_OK;

0 commit comments

Comments
 (0)