Content-Length: 259662 | pFad | http://github.com/postgrespro/postgres_cluster/commit/384dfbde19330541f7fb487f9352949aa06c812e

11 Fix unsafe use of strtol() on a non-null-terminated Text datum. · postgrespro/postgres_cluster@384dfbd · GitHub
Skip to content

Commit 384dfbd

Browse files
committed
Fix unsafe use of strtol() on a non-null-terminated Text datum.
jsonb_set() could produce wrong answers or incorrect error reports, or in the worst case even crash, when trying to convert a path-array element into an integer for use as an array subscript. Per report from Vitaly Burovoy. Back-patch to 9.5 where the faulty code was introduced (in commit c694701). Michael Paquier
1 parent 8320c62 commit 384dfbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/utils/adt/jsonfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3873,7 +3873,7 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
38733873
/* pick correct index */
38743874
if (level < path_len && !path_nulls[level])
38753875
{
3876-
char *c = VARDATA_ANY(path_elems[level]);
3876+
char *c = TextDatumGetCString(path_elems[level]);
38773877
long lindex;
38783878

38793879
errno = 0;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/384dfbde19330541f7fb487f9352949aa06c812e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy