Fixed access to uninit'd mem in repack_indexdef
If the tablespace is the last token in the indexdef, skip_ident returns a pointer *after* the term zero, so garbage may end up after the statement.
This commit is contained in:
parent
52e7761343
commit
109689586e
@ -662,12 +662,13 @@ repack_indexdef(PG_FUNCTION_ARGS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* tablespace is to replace */
|
/* tablespace is to replace */
|
||||||
char *tmp;
|
char *tmp, *limit;
|
||||||
|
limit = strchr(stmt.options, '\0');
|
||||||
tmp = skip_const(index, stmt.options, " TABLESPACE", NULL);
|
tmp = skip_const(index, stmt.options, " TABLESPACE", NULL);
|
||||||
appendStringInfoString(&str, stmt.options);
|
appendStringInfoString(&str, stmt.options);
|
||||||
appendStringInfo(&str, " %s", NameStr(*tablespace));
|
appendStringInfo(&str, " %s", NameStr(*tablespace));
|
||||||
tmp = skip_ident(index, tmp);
|
tmp = skip_ident(index, tmp);
|
||||||
if (*tmp)
|
if (tmp < limit)
|
||||||
appendStringInfo(&str, " %s", tmp);
|
appendStringInfo(&str, " %s", tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user