Fix unsafe use of strtol() on a non-null-terminated Text datum.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 5f95521b3a4ede720d8927383d79b11e37b6bc80
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2016-03-23T14:43:24Z
Releases: 9.5.2
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
c6947010ceb42143).

Michael Paquier

Files

PathChange+/−
src/backend/utils/adt/jsonfuncs.c modified +1 −1