Skip to content

Commit 6152635

Browse files
hlinnakaanju15bharti
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 3fbec9e504b1b4dca0a30d4081e1eaa687510fc5)
1 parent 07118b9 commit 6152635

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
@@ -121,7 +121,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
121121

122122
pcount = hv_iterinit(hv);
123123

124-
pairs = palloc(pcount * sizeof(Pairs));
124+
pairs = palloc_array(Pairs, pcount);
125125

126126
i = 0;
127127
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
@@ -150,7 +150,7 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
150150
Py_ssize_t i;
151151
Pairs *pairs;
152152

153-
pairs = palloc(pcount * sizeof(*pairs));
153+
pairs = palloc_array(Pairs, pcount);
154154

155155
for (i = 0; i < pcount; i++)
156156
{

0 commit comments

Comments
 (0)