In all versions of Node.js prior to 6.14.4, 8.11.4 and 10.9.0 when used with UCS-2 encoding (recognized by Node.js under the names 'ucs2'
, 'ucs-2'
, 'utf16le'
and 'utf-16le'
), Buffer#write()
can be abused to write outside of the bounds of a single Buffer
. Writes that start from the second-to-last position of a buffer cause a miscalculation of the maximum length of the input bytes to be written.