diff options
author | Bruce Momjian | 2003-10-09 13:38:05 +0000 |
---|---|---|
committer | Bruce Momjian | 2003-10-09 13:38:05 +0000 |
commit | 6011251bd26ae8c5eeb587a412c33023893636e3 (patch) | |
tree | 682299e177b1d092e1c8a96e64eb944e97ed78ba | |
parent | 538a960443a0af3770e20ad5713644b06c2b73f6 (diff) |
Someone report me small bug in contrib/pg_dumplo today. It's problem
with a little dirty snprintf() usage which I used some years ago:
snprintf(path, BUFSIZ, "%s/lo_dump.index", path);
Karel Zak
-rw-r--r-- | contrib/pg_dumplo/utils.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/pg_dumplo/utils.c b/contrib/pg_dumplo/utils.c index cdf5116ccf..6ab7ba0e7d 100644 --- a/contrib/pg_dumplo/utils.c +++ b/contrib/pg_dumplo/utils.c @@ -30,6 +30,7 @@ void index_file(LODumpMaster * pgLO) { char path[BUFSIZ]; + int sz; if (pgLO->action == ACTION_SHOW) return; @@ -49,7 +50,8 @@ index_file(LODumpMaster * pgLO) } } - snprintf(path, BUFSIZ, "%s/lo_dump.index", path); + sz = strlen(path); + strncat(path, "/lo_dump.index", BUFSIZ-sz); if ((pgLO->index = fopen(path, "w")) == NULL) { @@ -60,8 +62,8 @@ index_file(LODumpMaster * pgLO) } else if (pgLO->action != ACTION_NONE) { - - snprintf(path, BUFSIZ, "%s/lo_dump.index", path); + sz = strlen(path); + strncat(path, "/lo_dump.index", BUFSIZ-sz); if ((pgLO->index = fopen(path, "r")) == NULL) { |