1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

Fix erroneous space calculation leading to core dump in dumpProcLangs,

per report from Olivier Prenant.  Also fix off-by-one space calculation
in ReadToc; this woould not have hurt us until we had more than 100
dependencies for a single object, but wrong is wrong.
This commit is contained in:
Tom Lane
2003-05-03 22:18:59 +00:00
parent 5295fffc26
commit 228697179a
2 changed files with 7 additions and 4 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.70 2003/03/10 22:28:19 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.71 2003/05/03 22:18:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1916,7 +1916,7 @@ ReadToc(ArchiveHandle *AH)
depIdx = 0;
do
{
if (depIdx > depSize)
if (depIdx >= depSize)
{
depSize *= 2;
deps = realloc(deps, sizeof(char *) * depSize);
@ -1932,7 +1932,10 @@ ReadToc(ArchiveHandle *AH)
if (depIdx > 1) /* We have a non-null entry */
te->depOid = realloc(deps, sizeof(char *) * depIdx); /* trim it */
else
{
free(deps);
te->depOid = NULL; /* no deps */
}
}
else
te->depOid = NULL;