]> git.kaiwu.me - njs.git/commit
Fixed heap-buffer-overflow in Buffer.prototype.indexOf().
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 10 Oct 2024 00:32:11 +0000 (17:32 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 10 Oct 2024 16:43:41 +0000 (09:43 -0700)
commit6c8084b666cfe5db5d9401e7dff7981b5b2eb100
treecc820e3ea0051779c0f675b79dab4d5dfa23cd26
parent7b9ae6607b1bc9dae126a1a81ce1041bc79d8734
Fixed heap-buffer-overflow in Buffer.prototype.indexOf().

Previously, when `from` argument was provided heap-buffer-overflow might
happen due to lack of boundary check. `to = njs_min(to, length)`
statement was also removed because it has no effect, `to` is
equal to `length` here.

The issue was introduced in 5d15a8d6 (0.8.5).

This closes #794 issue on Github.
src/njs_buffer.c
src/qjs_buffer.c
test/buffer.t.js