Skip to content

Commit 17e033c

Browse files
hlinnakaRucha Kulkarni
authored andcommitted
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 (cherry picked from commit e42598a41e76ff12293e3aaeeeb5c5696a93f642)
1 parent 8c49a20 commit 17e033c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

contrib/hstore_plperl/hstore_plperl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
118118

119119
pcount = hv_iterinit(hv);
120120

121-
pairs = palloc(pcount * sizeof(Pairs));
121+
pairs = palloc_array(Pairs, pcount);
122122

123123
i = 0;
124124
while ((he = hv_iternext(hv)))

contrib/hstore_plpython/hstore_plpython.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
147147
Py_ssize_t i;
148148
Pairs *pairs;
149149

150-
pairs = palloc(pcount * sizeof(*pairs));
150+
pairs = palloc_array(Pairs, pcount);
151151

152152
for (i = 0; i < pcount; i++)
153153
{

0 commit comments

Comments
 (0)