diff -r -c pgsql-cvs/contrib/cube/cubeparse.y pgsql/contrib/cube/cubeparse.y *** pgsql-cvs/contrib/cube/cubeparse.y Thu Aug 29 21:50:21 2002 --- pgsql/contrib/cube/cubeparse.y Thu Aug 29 23:24:56 2002 *************** *** 164,171 **** position = parse_buffer_pos() > parse_buffer_size() ? parse_buffer_pos() - 1 : parse_buffer_pos(); ! sprintf( buf, "%s at or before position %d, character ('%c', \\%03o), input: '%s'\n", msg, position, --- 164,172 ---- position = parse_buffer_pos() > parse_buffer_size() ? parse_buffer_pos() - 1 : parse_buffer_pos(); ! snprintf( buf, + 256, "%s at or before position %d, character ('%c', \\%03o), input: '%s'\n", msg, position, diff -r -c pgsql-cvs/contrib/intarray/_int.c pgsql/contrib/intarray/_int.c *** pgsql-cvs/contrib/intarray/_int.c Thu Aug 29 21:50:23 2002 --- pgsql/contrib/intarray/_int.c Thu Aug 29 22:09:45 2002 *************** *** 22,27 **** --- 22,28 ---- #include "utils/array.h" #include "utils/builtins.h" #include "storage/bufpage.h" + #include "lib/stringinfo.h" /* number ranges for compression */ #define MAXNUMRANGE 100 *************** *** 99,118 **** static void printarr(ArrayType *a, int num) { ! char bbb[16384]; char *cur; int l; int *d; d = ARRPTR(a); ! *bbb = '\0'; ! cur = bbb; for (l = 0; l < min(num, ARRNELEMS(a)); l++) { ! sprintf(cur, "%d ", d[l]); ! cur = strchr(cur, '\0'); } ! elog(DEBUG3, "\t\t%s", bbb); } static void printbitvec(BITVEC bv) --- 100,118 ---- static void printarr(ArrayType *a, int num) { ! StringInfoData bbb; char *cur; int l; int *d; d = ARRPTR(a); ! initStringInfo(&bbb); for (l = 0; l < min(num, ARRNELEMS(a)); l++) { ! appendStringInfo(&bbb, "%d ", d[l]); } ! elog(DEBUG3, "\t\t%s", bbb.data); ! pfree(bbb.data); } static void printbitvec(BITVEC bv) *************** *** 1924,1930 **** NODE *tmp; int4 pos=0; #ifdef BS_DEBUG ! char pbuf[16384],*cur; #endif state.buf = buf; --- 1924,1930 ---- NODE *tmp; int4 pos=0; #ifdef BS_DEBUG ! StringInfoData pbuf; #endif state.buf = buf; *************** *** 1955,1970 **** pos = query->size-1; findoprnd( ptr, &pos ); #ifdef BS_DEBUG ! cur = pbuf; ! *cur = '\0'; for( i=0;isize;i++ ) { if ( ptr[i].type == OPR ) ! sprintf(cur, "%c(%d) ", ptr[i].val, ptr[i].left); else ! sprintf(cur, "%d ", ptr[i].val ); ! cur = strchr(cur,'\0'); } ! elog(DEBUG3,"POR: %s", pbuf); #endif PG_RETURN_POINTER( query ); --- 1955,1969 ---- pos = query->size-1; findoprnd( ptr, &pos ); #ifdef BS_DEBUG ! initStringInfo(&pbuf); for( i=0;isize;i++ ) { if ( ptr[i].type == OPR ) ! appendStringInfo(&pbuf, "%c(%d) ", ptr[i].val, ptr[i].left); else ! appendStringInfo(&pbuf, "%d ", ptr[i].val ); } ! elog(DEBUG3,"POR: %s", pbuf.data); ! pfree(pbuf.data); #endif PG_RETURN_POINTER( query ); diff -r -c pgsql-cvs/contrib/seg/segparse.y pgsql/contrib/seg/segparse.y *** pgsql-cvs/contrib/seg/segparse.y Thu Aug 29 21:50:21 2002 --- pgsql/contrib/seg/segparse.y Thu Aug 29 22:27:26 2002 *************** *** 144,150 **** sscanf(value, "%f", &result); if ( errno ) { ! sprintf(buf, "numeric value %s unrepresentable", value); reset_parse_buffer(); elog(ERROR, buf); } --- 144,150 ---- sscanf(value, "%f", &result); if ( errno ) { ! snprintf(buf, 256, "numeric value %s unrepresentable", value); reset_parse_buffer(); elog(ERROR, buf); } *************** *** 165,172 **** position = parse_buffer_pos() > parse_buffer_size() ? parse_buffer_pos() - 1 : parse_buffer_pos(); ! sprintf( buf, "%s at or near position %d, character ('%c', \\%03o), input: '%s'\n", msg, position, --- 165,173 ---- position = parse_buffer_pos() > parse_buffer_size() ? parse_buffer_pos() - 1 : parse_buffer_pos(); ! snprintf( buf, + 256, "%s at or near position %d, character ('%c', \\%03o), input: '%s'\n", msg, position, diff -r -c pgsql-cvs/contrib/spi/refint.c pgsql/contrib/spi/refint.c *** pgsql-cvs/contrib/spi/refint.c Thu Aug 29 21:50:21 2002 --- pgsql/contrib/spi/refint.c Thu Aug 29 22:33:28 2002 *************** *** 112,118 **** * Construct ident string as TriggerName $ TriggeredRelationId and try * to find prepared execution plan. */ ! snprintf(ident, 2 * NAMEDATALEN, "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &PPlans, &nPPlans); /* if there is no plan then allocate argtypes for preparation */ --- 112,118 ---- * Construct ident string as TriggerName $ TriggeredRelationId and try * to find prepared execution plan. */ ! snprintf(ident, sizeof(ident), "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &PPlans, &nPPlans); /* if there is no plan then allocate argtypes for preparation */ *************** *** 160,169 **** * Construct query: SELECT 1 FROM _referenced_relation_ WHERE * Pkey1 = $1 [AND Pkey2 = $2 [...]] */ ! snprintf(sql, 8192, "select 1 from %s where ", relname); for (i = 0; i < nkeys; i++) { ! snprintf(sql + strlen(sql), 8192 - strlen(sql), "%s = $%d %s", args[i + nkeys + 1], i + 1, (i < nkeys - 1) ? "and " : ""); } --- 160,169 ---- * Construct query: SELECT 1 FROM _referenced_relation_ WHERE * Pkey1 = $1 [AND Pkey2 = $2 [...]] */ ! snprintf(sql, sizeof(sql), "select 1 from %s where ", relname); for (i = 0; i < nkeys; i++) { ! snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s = $%d %s", args[i + nkeys + 1], i + 1, (i < nkeys - 1) ? "and " : ""); } *************** *** 320,326 **** * Construct ident string as TriggerName $ TriggeredRelationId and try * to find prepared execution plan(s). */ ! snprintf(ident, 2 * NAMEDATALEN, "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &FPlans, &nFPlans); /* if there is no plan(s) then allocate argtypes for preparation */ --- 320,326 ---- * Construct ident string as TriggerName $ TriggeredRelationId and try * to find prepared execution plan(s). */ ! snprintf(ident, sizeof(ident), "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &FPlans, &nFPlans); /* if there is no plan(s) then allocate argtypes for preparation */ *************** *** 411,417 **** */ if (action == 'r') ! snprintf(sql, 8192, "select 1 from %s where ", relname); /*--------- * For 'C'ascade action we construct DELETE query --- 411,417 ---- */ if (action == 'r') ! snprintf(sql, sizeof(sql), "select 1 from %s where ", relname); /*--------- * For 'C'ascade action we construct DELETE query *************** *** 438,444 **** char *nv; int k; ! snprintf(sql, 8192, "update %s set ", relname); for (k = 1; k <= nkeys; k++) { int is_char_type = 0; --- 438,444 ---- char *nv; int k; ! snprintf(sql, sizeof(sql), "update %s set ", relname); for (k = 1; k <= nkeys; k++) { int is_char_type = 0; *************** *** 461,467 **** * is_char_type =1 i set ' ' for define a new * value */ ! snprintf(sql + strlen(sql), 8192 - strlen(sql), " %s = %s%s%s %s ", args2[k], (is_char_type > 0) ? "'" : "", nv, (is_char_type > 0) ? "'" : "", (k < nkeys) ? ", " : ""); --- 461,467 ---- * is_char_type =1 i set ' ' for define a new * value */ ! snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " %s = %s%s%s %s ", args2[k], (is_char_type > 0) ? "'" : "", nv, (is_char_type > 0) ? "'" : "", (k < nkeys) ? ", " : ""); *************** *** 472,478 **** } else /* DELETE */ ! snprintf(sql, 8192, "delete from %s where ", relname); } --- 472,478 ---- } else /* DELETE */ ! snprintf(sql, sizeof(sql), "delete from %s where ", relname); } *************** *** 484,493 **** */ else if (action == 's') { ! snprintf(sql, 8192, "update %s set ", relname); for (i = 1; i <= nkeys; i++) { ! snprintf(sql + strlen(sql), 8192 - strlen(sql), "%s = null%s", args2[i], (i < nkeys) ? ", " : ""); } --- 484,493 ---- */ else if (action == 's') { ! snprintf(sql, sizeof(sql), "update %s set ", relname); for (i = 1; i <= nkeys; i++) { ! snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s = null%s", args2[i], (i < nkeys) ? ", " : ""); } *************** *** 497,503 **** /* Construct WHERE qual */ for (i = 1; i <= nkeys; i++) { ! snprintf(sql + strlen(sql), 8192 - strlen(sql), "%s = $%d %s", args2[i], i, (i < nkeys) ? "and " : ""); } --- 497,503 ---- /* Construct WHERE qual */ for (i = 1; i <= nkeys; i++) { ! snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s = $%d %s", args2[i], i, (i < nkeys) ? "and " : ""); } *************** *** 547,553 **** relname = args[0]; ! snprintf(ident, 2 * NAMEDATALEN, "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &FPlans, &nFPlans); ret = SPI_execp(plan->splan[r], kvals, NULL, tcount); /* we have no NULLs - so we pass ^^^^ here */ --- 547,553 ---- relname = args[0]; ! snprintf(ident, sizeof(ident), "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &FPlans, &nFPlans); ret = SPI_execp(plan->splan[r], kvals, NULL, tcount); /* we have no NULLs - so we pass ^^^^ here */ diff -r -c pgsql-cvs/contrib/spi/timetravel.c pgsql/contrib/spi/timetravel.c *** pgsql-cvs/contrib/spi/timetravel.c Thu Aug 29 21:50:21 2002 --- pgsql/contrib/spi/timetravel.c Thu Aug 29 22:37:25 2002 *************** *** 250,256 **** * Construct ident string as TriggerName $ TriggeredRelationId and try * to find prepared execution plan. */ ! snprintf(ident, 2 * NAMEDATALEN, "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &Plans, &nPlans); /* if there is no plan ... */ --- 250,256 ---- * Construct ident string as TriggerName $ TriggeredRelationId and try * to find prepared execution plan. */ ! snprintf(ident, sizeof(ident), "%s$%u", trigger->tgname, rel->rd_id); plan = find_plan(ident, &Plans, &nPlans); /* if there is no plan ... */ *************** *** 266,275 **** /* * Construct query: INSERT INTO _relation_ VALUES ($1, ...) */ ! snprintf(sql, 8192, "INSERT INTO %s VALUES (", relname); for (i = 1; i <= natts; i++) { ! snprintf(sql + strlen(sql), 8192 - strlen(sql), "$%d%s", i, (i < natts) ? ", " : ")"); ctypes[i - 1] = SPI_gettypeid(tupdesc, i); } --- 266,275 ---- /* * Construct query: INSERT INTO _relation_ VALUES ($1, ...) */ ! snprintf(sql, sizeof(sql), "INSERT INTO %s VALUES (", relname); for (i = 1; i <= natts; i++) { ! snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "$%d%s", i, (i < natts) ? ", " : ")"); ctypes[i - 1] = SPI_gettypeid(tupdesc, i); } diff -r -c pgsql-cvs/doc/src/sgml/spi.sgml pgsql/doc/src/sgml/spi.sgml *** pgsql-cvs/doc/src/sgml/spi.sgml Thu Aug 29 21:50:14 2002 --- pgsql/doc/src/sgml/spi.sgml Thu Aug 29 22:39:24 2002 *************** *** 3815,3821 **** HeapTuple tuple = tuptable->vals[j]; for (i = 1, buf[0] = 0; i <= tupdesc->natts; i++) ! sprintf(buf + strlen (buf), " %s%s", SPI_getvalue(tuple, tupdesc, i), (i == tupdesc->natts) ? " " : " |"); elog (INFO, "EXECQ: %s", buf); --- 3815,3821 ---- HeapTuple tuple = tuptable->vals[j]; for (i = 1, buf[0] = 0; i <= tupdesc->natts; i++) ! snprintf(buf + strlen (buf), sizeof(buf) - strlen(buf)," %s%s", SPI_getvalue(tuple, tupdesc, i), (i == tupdesc->natts) ? " " : " |"); elog (INFO, "EXECQ: %s", buf); diff -r -c pgsql-cvs/src/backend/parser/analyze.c pgsql/src/backend/parser/analyze.c *** pgsql-cvs/src/backend/parser/analyze.c Thu Aug 29 21:50:20 2002 --- pgsql/src/backend/parser/analyze.c Thu Aug 29 22:40:19 2002 *************** *** 2153,2159 **** /* * Make the leaf query be a subquery in the top-level rangetable. */ ! snprintf(selectName, 32, "*SELECT* %d", length(pstate->p_rtable) + 1); rte = addRangeTableEntryForSubquery(pstate, selectQuery, makeAlias(selectName, NIL), --- 2153,2159 ---- /* * Make the leaf query be a subquery in the top-level rangetable. */ ! snprintf(selectName, sizeof(selectName), "*SELECT* %d", length(pstate->p_rtable) + 1); rte = addRangeTableEntryForSubquery(pstate, selectQuery, makeAlias(selectName, NIL), diff -r -c pgsql-cvs/src/backend/storage/file/fd.c pgsql/src/backend/storage/file/fd.c *** pgsql-cvs/src/backend/storage/file/fd.c Thu Aug 29 21:50:20 2002 --- pgsql/src/backend/storage/file/fd.c Thu Aug 29 22:45:29 2002 *************** *** 345,358 **** Vfd *vfdP = &VfdCache[mru]; char buf[2048]; ! sprintf(buf, "LRU: MOST %d ", mru); while (mru != 0) { mru = vfdP->lruLessRecently; vfdP = &VfdCache[mru]; ! sprintf(buf + strlen(buf), "%d ", mru); } ! sprintf(buf + strlen(buf), "LEAST"); elog(LOG, buf); } #endif /* FDDEBUG */ --- 345,358 ---- Vfd *vfdP = &VfdCache[mru]; char buf[2048]; ! snprintf(buf, sizeof(buf), "LRU: MOST %d ", mru); while (mru != 0) { mru = vfdP->lruLessRecently; vfdP = &VfdCache[mru]; ! snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%d ", mru); } ! snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "LEAST"); elog(LOG, buf); } #endif /* FDDEBUG */ diff -r -c pgsql-cvs/src/backend/utils/adt/ri_triggers.c pgsql/src/backend/utils/adt/ri_triggers.c *** pgsql-cvs/src/backend/utils/adt/ri_triggers.c Thu Aug 29 21:50:19 2002 --- pgsql/src/backend/utils/adt/ri_triggers.c Thu Aug 29 23:38:54 2002 *************** *** 262,268 **** * ---------- */ quoteRelationName(pkrelname, pk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x FOR UPDATE OF x", pkrelname); /* --- 262,268 ---- * ---------- */ quoteRelationName(pkrelname, pk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x FOR UPDATE OF x", pkrelname); /* *************** *** 413,425 **** * ---------- */ quoteRelationName(pkrelname, pk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x", pkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(fk_rel->rd_att, --- 413,425 ---- * ---------- */ quoteRelationName(pkrelname, pk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x", pkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(fk_rel->rd_att, *************** *** 614,626 **** * ---------- */ quoteRelationName(pkrelname, pk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x", pkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 614,626 ---- * ---------- */ quoteRelationName(pkrelname, pk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x", pkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 816,828 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 816,828 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 1050,1062 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 1050,1062 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 1257,1269 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "DELETE FROM ONLY %s", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 1257,1269 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "DELETE FROM ONLY %s", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 1474,1480 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; --- 1474,1480 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; *************** *** 1482,1490 **** { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), "%s %s = $%d", querysep, attname, i+1); ! sprintf(qualstr + strlen(qualstr), " %s %s = $%d", qualsep, attname, j+1); querysep = ","; qualsep = "AND"; --- 1482,1490 ---- { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = $%d", querysep, attname, i+1); ! snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d", qualsep, attname, j+1); querysep = ","; qualsep = "AND"; *************** *** 1698,1710 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 1698,1710 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 1926,1938 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 1926,1938 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x", fkrelname); querysep = "WHERE"; for (i = 0; i < qkey.nkeypairs; i++) { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d", querysep, attname, i+1); querysep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 2140,2146 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; --- 2140,2146 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; *************** *** 2148,2156 **** { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), "%s %s = NULL", querysep, attname); ! sprintf(qualstr + strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); querysep = ","; qualsep = "AND"; --- 2148,2156 ---- { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL", querysep, attname); ! snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); querysep = ","; qualsep = "AND"; *************** *** 2384,2390 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; --- 2384,2390 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; *************** *** 2400,2410 **** !ri_OneKeyEqual(pk_rel, i, old_row, new_row, &qkey, RI_KEYPAIR_PK_IDX)) { ! sprintf(querystr + strlen(querystr), "%s %s = NULL", querysep, attname); querysep = ","; } ! sprintf(qualstr + strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); qualsep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 2400,2410 ---- !ri_OneKeyEqual(pk_rel, i, old_row, new_row, &qkey, RI_KEYPAIR_PK_IDX)) { ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL", querysep, attname); querysep = ","; } ! snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); qualsep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, *************** *** 2616,2622 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; --- 2616,2622 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; *************** *** 2624,2632 **** { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! sprintf(querystr + strlen(querystr), "%s %s = NULL", querysep, attname); ! sprintf(qualstr + strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); querysep = ","; qualsep = "AND"; --- 2624,2632 ---- { quoteOneName(attname, tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]); ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL", querysep, attname); ! snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); querysep = ","; qualsep = "AND"; *************** *** 2885,2891 **** * ---------- */ quoteRelationName(fkrelname, fk_rel); ! sprintf(querystr, "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; --- 2885,2891 ---- * ---------- */ quoteRelationName(fkrelname, fk_rel); ! snprintf(querystr, sizeof(querystr), "UPDATE ONLY %s SET", fkrelname); qualstr[0] = '\0'; querysep = ""; qualsep = "WHERE"; *************** *** 2901,2911 **** !ri_OneKeyEqual(pk_rel, i, old_row, new_row, &qkey, RI_KEYPAIR_PK_IDX)) { ! sprintf(querystr + strlen(querystr), "%s %s = NULL", querysep, attname); querysep = ","; } ! sprintf(qualstr + strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); qualsep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, --- 2901,2911 ---- !ri_OneKeyEqual(pk_rel, i, old_row, new_row, &qkey, RI_KEYPAIR_PK_IDX)) { ! snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL", querysep, attname); querysep = ","; } ! snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d", qualsep, attname, i+1); qualsep = "AND"; queryoids[i] = SPI_gettypeid(pk_rel->rd_att, diff -r -c pgsql-cvs/src/bin/pg_dump/pg_dump.c pgsql/src/bin/pg_dump/pg_dump.c *** pgsql-cvs/src/bin/pg_dump/pg_dump.c Thu Aug 29 21:50:15 2002 --- pgsql/src/bin/pg_dump/pg_dump.c Thu Aug 29 23:05:13 2002 *************** *** 5706,5712 **** PQclear(res); if (g_verbose) write_msg(NULL, "maximum system oid is %u\n", max_oid); ! snprintf(sql, 1024, "CREATE TEMPORARY TABLE pgdump_oid (dummy integer);\n" "COPY pgdump_oid WITH OIDS FROM stdin;\n" "%u\t0\n" --- 5706,5712 ---- PQclear(res); if (g_verbose) write_msg(NULL, "maximum system oid is %u\n", max_oid); ! snprintf(sql, sizeof(sql), "CREATE TEMPORARY TABLE pgdump_oid (dummy integer);\n" "COPY pgdump_oid WITH OIDS FROM stdin;\n" "%u\t0\n" diff -r -c pgsql-cvs/src/bin/psql/command.c pgsql/src/bin/psql/command.c *** pgsql-cvs/src/bin/psql/command.c Thu Aug 29 21:50:15 2002 --- pgsql/src/bin/psql/command.c Thu Aug 29 23:08:14 2002 *************** *** 1549,1555 **** #ifndef WIN32 const char *tmpdirenv = getenv("TMPDIR"); ! sprintf(fnametmp, "%s/psql.edit.%ld.%ld", tmpdirenv ? tmpdirenv : "/tmp", (long) geteuid(), (long) getpid()); #else --- 1549,1555 ---- #ifndef WIN32 const char *tmpdirenv = getenv("TMPDIR"); ! snprintf(fnametmp, sizeof(fnametmp), "%s/psql.edit.%ld.%ld", tmpdirenv ? tmpdirenv : "/tmp", (long) geteuid(), (long) getpid()); #else diff -r -c pgsql-cvs/src/interfaces/ecpg/preproc/pgc.l pgsql/src/interfaces/ecpg/preproc/pgc.l *** pgsql-cvs/src/interfaces/ecpg/preproc/pgc.l Thu Aug 29 21:50:16 2002 --- pgsql/src/interfaces/ecpg/preproc/pgc.l Thu Aug 29 23:11:25 2002 *************** *** 405,411 **** mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier"); if (literallen >= NAMEDATALEN) { ! sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"", literalbuf, NAMEDATALEN-1, literalbuf); literalbuf[NAMEDATALEN-1] = '\0'; mmerror(PARSE_ERROR, ET_WARNING, errortext); --- 405,411 ---- mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier"); if (literallen >= NAMEDATALEN) { ! snprintf(errortext, sizeof(errortext), "identifier \"%s\" will be truncated to \"%.*s\"", literalbuf, NAMEDATALEN-1, literalbuf); literalbuf[NAMEDATALEN-1] = '\0'; mmerror(PARSE_ERROR, ET_WARNING, errortext); *************** *** 831,837 **** fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno); continue; } ! sprintf (inc_file, "%s/%s", ip->path, yytext); yyin = fopen( inc_file, "r" ); if (!yyin) { --- 831,837 ---- fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno); continue; } ! snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext); yyin = fopen( inc_file, "r" ); if (!yyin) { *************** *** 844,850 **** } if (!yyin) { ! sprintf(errortext, "Cannot open include file %s in line %d\n", yytext, yylineno); mmerror(NO_INCLUDE_FILE, ET_FATAL, errortext); } --- 844,850 ---- } if (!yyin) { ! snprintf(errortext, sizeof(errortext), "Cannot open include file %s in line %d\n", yytext, yylineno); mmerror(NO_INCLUDE_FILE, ET_FATAL, errortext); } diff -r -c pgsql-cvs/src/interfaces/ecpg/preproc/preproc.y pgsql/src/interfaces/ecpg/preproc/preproc.y *** pgsql-cvs/src/interfaces/ecpg/preproc/preproc.y Thu Aug 29 21:50:16 2002 --- pgsql/src/interfaces/ecpg/preproc/preproc.y Thu Aug 29 23:14:03 2002 *************** *** 582,588 **** if (ptr == NULL) { ! sprintf(errortext, "trying to open undeclared cursor %s\n", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 582,588 ---- if (ptr == NULL) { ! snprintf(errortext, sizeof(errortext), "trying to open undeclared cursor %s\n", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 1119,1125 **** { if (strlen($4) > 0) { ! sprintf(errortext, "Currently unsupported CREATE TABLE / COLLATE %s will be passed to backend", $4); mmerror(PARSE_ERROR, ET_WARNING, errortext); } $$ = cat_str(4, $1, $2, $3, $4); --- 1119,1125 ---- { if (strlen($4) > 0) { ! snprintf(errortext, sizeof(errortext), "Currently unsupported CREATE TABLE / COLLATE %s will be passed to backend", $4); mmerror(PARSE_ERROR, ET_WARNING, errortext); } $$ = cat_str(4, $1, $2, $3, $4); *************** *** 2406,2412 **** if (strcmp($2, ptr->name) == 0) { /* re-definition is a bug */ ! sprintf(errortext, "cursor %s already defined", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } --- 2406,2412 ---- if (strcmp($2, ptr->name) == 0) { /* re-definition is a bug */ ! snprintf(errortext, sizeof(errortext), "cursor %s already defined", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } *************** *** 3628,3634 **** /* old style: dbname[@server][:port] */ if (strlen($2) > 0 && *($2) != '@') { ! sprintf(errortext, "Expected '@', found '%s'", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 3628,3634 ---- /* old style: dbname[@server][:port] */ if (strlen($2) > 0 && *($2) != '@') { ! sprintf(errortext, sizeof(errortext), "Expected '@', found '%s'", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 3639,3651 **** /* new style: :postgresql://server[:port][/dbname] */ if (strncmp($1, "unix:postgresql", strlen("unix:postgresql")) != 0 && strncmp($1, "tcp:postgresql", strlen("tcp:postgresql")) != 0) { ! sprintf(errortext, "only protocols 'tcp' and 'unix' and database type 'postgresql' are supported"); mmerror(PARSE_ERROR, ET_ERROR, errortext); } if (strncmp($3, "//", strlen("//")) != 0) { ! sprintf(errortext, "Expected '://', found '%s'", $3); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 3639,3651 ---- /* new style: :postgresql://server[:port][/dbname] */ if (strncmp($1, "unix:postgresql", strlen("unix:postgresql")) != 0 && strncmp($1, "tcp:postgresql", strlen("tcp:postgresql")) != 0) { ! snprintf(errortext, sizeof(errortext), "only protocols 'tcp' and 'unix' and database type 'postgresql' are supported"); mmerror(PARSE_ERROR, ET_ERROR, errortext); } if (strncmp($3, "//", strlen("//")) != 0) { ! snprintf(errortext, sizeof(errortext), "Expected '://', found '%s'", $3); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 3653,3659 **** strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0 && strncmp($3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0) { ! sprintf(errortext, "unix domain sockets only work on 'localhost' but not on '%9.9s'", $3 + strlen("//")); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 3653,3659 ---- strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0 && strncmp($3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0) { ! snprintf(errortext, sizeof(errortext), "unix domain sockets only work on 'localhost' but not on '%9.9s'", $3 + strlen("//")); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 3686,3698 **** { if (strcmp($2, "postgresql") != 0 && strcmp($2, "postgres") != 0) { ! sprintf(errortext, "Expected 'postgresql', found '%s'", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } if (strcmp($1, "tcp") != 0 && strcmp($1, "unix") != 0) { ! sprintf(errortext, "Illegal connection type %s", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 3686,3698 ---- { if (strcmp($2, "postgresql") != 0 && strcmp($2, "postgres") != 0) { ! snprintf(errortext, sizeof(errortext), "Expected 'postgresql', found '%s'", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } if (strcmp($1, "tcp") != 0 && strcmp($1, "unix") != 0) { ! snprintf(errortext, sizeof(errortext), "Illegal connection type %s", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 3704,3710 **** { if (strcmp($1, "@") != 0 && strcmp($1, "//") != 0) { ! sprintf(errortext, "Expected '@' or '://', found '%s'", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 3704,3710 ---- { if (strcmp($1, "@") != 0 && strcmp($1, "//") != 0) { ! snprintf(errortext, sizeof(errortext), "Expected '@' or '://', found '%s'", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 3806,3812 **** if (strcmp($1, "?") != 0) { ! sprintf(errortext, "unrecognised token '%s'", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } --- 3806,3812 ---- if (strcmp($1, "?") != 0) { ! snprintf(errortext, sizeof(errortext), "unrecognised token '%s'", $1); mmerror(PARSE_ERROR, ET_ERROR, errortext); } *************** *** 3829,3835 **** if (strcmp($2, ptr->name) == 0) { /* re-definition is a bug */ ! sprintf(errortext, "cursor %s already defined", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } --- 3829,3835 ---- if (strcmp($2, ptr->name) == 0) { /* re-definition is a bug */ ! snprintf(errortext, sizeof(errortext), "cursor %s already defined", $2); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } *************** *** 3923,3929 **** if (strcmp($5, ptr->name) == 0) { /* re-definition is a bug */ ! sprintf(errortext, "Type %s already defined", $5); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } --- 3923,3929 ---- if (strcmp($5, ptr->name) == 0) { /* re-definition is a bug */ ! snprintf(errortext, sizeof(errortext), "Type %s already defined", $5); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } *************** *** 4528,4534 **** if (strcmp($3, ptr->name) == 0) { /* re-definition is a bug */ ! sprintf(errortext, "Type %s already defined", $3); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } --- 4528,4534 ---- if (strcmp($3, ptr->name) == 0) { /* re-definition is a bug */ ! snprintf(errortext, sizeof(errortext), "Type %s already defined", $3); mmerror(PARSE_ERROR, ET_ERROR, errortext); } } diff -r -c pgsql-cvs/src/interfaces/ecpg/preproc/variable.c pgsql/src/interfaces/ecpg/preproc/variable.c *** pgsql-cvs/src/interfaces/ecpg/preproc/variable.c Thu Aug 29 21:50:16 2002 --- pgsql/src/interfaces/ecpg/preproc/variable.c Thu Aug 29 23:15:13 2002 *************** *** 80,92 **** { if (p->type->type != ECPGt_array) { ! sprintf(errortext, "variable %s is not a pointer", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union) { ! sprintf(errortext, "variable %s is not a pointer to a structure or a union", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } --- 80,92 ---- { if (p->type->type != ECPGt_array) { ! snprintf(errortext, sizeof(errortext), "variable %s is not a pointer", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union) { ! snprintf(errortext, sizeof(errortext), "variable %s is not a pointer to a structure or a union", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } *************** *** 100,106 **** { if (p->type->type != ECPGt_struct && p->type->type != ECPGt_union) { ! sprintf(errortext, "variable %s is neither a structure nor a union", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } --- 100,106 ---- { if (p->type->type != ECPGt_struct && p->type->type != ECPGt_union) { ! snprintf(errortext, sizeof(errortext), "variable %s is neither a structure nor a union", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } *************** *** 142,148 **** if (p == NULL) { ! sprintf(errortext, "The variable %s is not declared", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } --- 142,148 ---- if (p == NULL) { ! snprintf(errortext, sizeof(errortext), "The variable %s is not declared", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } *************** *** 290,296 **** for (this = types; this && strcmp(this->name, name); this = this->next); if (!this) { ! sprintf(errortext, "invalid datatype '%s'", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } --- 290,296 ---- for (this = types; this && strcmp(this->name, name); this = this->next); if (!this) { ! snprintf(errortext, sizeof(errortext), "invalid datatype '%s'", name); mmerror(PARSE_ERROR, ET_FATAL, errortext); } *************** *** 320,326 **** } if (pointer_len>2) ! { sprintf(errortext, "No multilevel (more than 2) pointer supported %d",pointer_len); mmerror(PARSE_ERROR, ET_FATAL, errortext); /* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/ } --- 320,326 ---- } if (pointer_len>2) ! { snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d",pointer_len); mmerror(PARSE_ERROR, ET_FATAL, errortext); /* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/ } diff -r -c pgsql-cvs/src/interfaces/libpgeasy/examples/pgwordcount.c pgsql/src/interfaces/libpgeasy/examples/pgwordcount.c *** pgsql-cvs/src/interfaces/libpgeasy/examples/pgwordcount.c Thu Aug 29 21:50:16 2002 --- pgsql/src/interfaces/libpgeasy/examples/pgwordcount.c Thu Aug 29 23:16:12 2002 *************** *** 42,48 **** if (scanf("%s", line) != 1) break; doquery("BEGIN WORK"); ! sprintf(query, "\ DECLARE c_words BINARY CURSOR FOR \ SELECT count(*) \ FROM words \ --- 42,48 ---- if (scanf("%s", line) != 1) break; doquery("BEGIN WORK"); ! snprintf(query, sizeof(query), "\ DECLARE c_words BINARY CURSOR FOR \ SELECT count(*) \ FROM words \ *************** *** 56,66 **** doquery("COMMIT WORK"); if (count == 0) ! sprintf(query, "\ INSERT INTO words \ VALUES (1, '%s')", line); else ! sprintf(query, "\ UPDATE words \ SET matches = matches + 1 \ WHERE word = '%s'", line); --- 56,66 ---- doquery("COMMIT WORK"); if (count == 0) ! snprintf(query, sizeof(query), "\ INSERT INTO words \ VALUES (1, '%s')", line); else ! snprintf(query, sizeof(query), "\ UPDATE words \ SET matches = matches + 1 \ WHERE word = '%s'", line); diff -r -c pgsql-cvs/src/interfaces/libpgtcl/pgtclCmds.c pgsql/src/interfaces/libpgtcl/pgtclCmds.c *** pgsql-cvs/src/interfaces/libpgtcl/pgtclCmds.c Thu Aug 29 21:50:16 2002 --- pgsql/src/interfaces/libpgtcl/pgtclCmds.c Thu Aug 29 23:19:56 2002 *************** *** 1579,1585 **** lobjId = lo_import(conn, filename); if (lobjId == InvalidOid) { ! sprintf(interp->result, "Pg_lo_import of '%s' failed", filename); return TCL_ERROR; } sprintf(interp->result, "%u", lobjId); --- 1579,1586 ---- lobjId = lo_import(conn, filename); if (lobjId == InvalidOid) { ! /* What is the maximum size of this? FIXME if this is not a good quess */ ! snprintf(interp->result, 128, "Pg_lo_import of '%s' failed", filename); return TCL_ERROR; } sprintf(interp->result, "%u", lobjId); diff -r -c pgsql-cvs/src/interfaces/libpq/fe-auth.c pgsql/src/interfaces/libpq/fe-auth.c *** pgsql-cvs/src/interfaces/libpq/fe-auth.c Thu Aug 29 21:50:16 2002 --- pgsql/src/interfaces/libpq/fe-auth.c Thu Aug 29 23:21:17 2002 *************** *** 142,148 **** { char tktbuf[MAXPGPATH]; ! (void) sprintf(tktbuf, "%s@%s", tkt_string(), realm); krb_set_tkt_string(tktbuf); } } --- 142,148 ---- { char tktbuf[MAXPGPATH]; ! (void) snprintf(tktbuf, sizeof(tktbuf), "%s@%s", tkt_string(), realm); krb_set_tkt_string(tktbuf); } } *************** *** 618,630 **** case AUTH_REQ_PASSWORD: if (password == NULL || *password == '\0') { ! (void) sprintf(PQerrormsg, "fe_sendauth: no password supplied\n"); return STATUS_ERROR; } if (pg_password_sendauth(conn, password, areq) != STATUS_OK) { ! (void) sprintf(PQerrormsg, "fe_sendauth: error sending password authentication\n"); return STATUS_ERROR; } --- 618,630 ---- case AUTH_REQ_PASSWORD: if (password == NULL || *password == '\0') { ! (void) snprintf(PQerrormsg, PQERRORMSG_LENGTH, "fe_sendauth: no password supplied\n"); return STATUS_ERROR; } if (pg_password_sendauth(conn, password, areq) != STATUS_OK) { ! (void) snprintf(PQerrormsg, PQERRORMSG_LENGTH, "fe_sendauth: error sending password authentication\n"); return STATUS_ERROR; }