Use palloc_array() in a few more places to avoid overflow

These could overflow on 32-bit systems.

Backpatch-through: 14
Security: CVE-2026-6473
This commit is contained in:
Heikki Linnakangas 2026-05-11 21:18:06 +03:00
parent 6f0bff33d7
commit e42598a41e
2 changed files with 2 additions and 2 deletions

View file

@ -118,7 +118,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
pcount = hv_iterinit(hv);
pairs = palloc(pcount * sizeof(Pairs));
pairs = palloc_array(Pairs, pcount);
i = 0;
while ((he = hv_iternext(hv)))

View file

@ -147,7 +147,7 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
Py_ssize_t i;
Pairs *pairs;
pairs = palloc(pcount * sizeof(*pairs));
pairs = palloc_array(Pairs, pcount);
for (i = 0; i < pcount; i++)
{