Skip to content

Commit c85a6a3

Browse files
hlinnakashardgupta
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 c9447b8bd078f40c8b4969c63bebbb2cc228582b)
1 parent c1a53c8 commit c85a6a3

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
@@ -153,7 +153,7 @@ plpython_to_hstore(PG_FUNCTION_ARGS)
153153
Py_ssize_t i;
154154
Pairs *pairs;
155155

156-
pairs = palloc(pcount * sizeof(*pairs));
156+
pairs = palloc_array(Pairs, pcount);
157157

158158
for (i = 0; i < pcount; i++)
159159
{

0 commit comments

Comments
 (0)