]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1443: potential buffer underflow in insertchar() v9.1.1443
authorjinyaoguo <guo846@purdue.edu>
Mon, 9 Jun 2025 18:31:17 +0000 (20:31 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 9 Jun 2025 18:31:17 +0000 (20:31 +0200)
commit82a96e3dc0ee8f45bb0c1fe17a0cec1db7582e8f
treeabd53c028a2b00371fe009439682441e8ae8e460
parent69565e3618209001eeeb6a35f14a19d47aaaa8f8
patch 9.1.1443: potential buffer underflow in insertchar()

Problem:  potential buffer underflow in insertchar()
Solution: verify that end_len is larger than zero
          (jinyaoguo)

When parsing the end-comment leader, end_len can be zero if
copy_option_part() writes no characters. The existing check
unconditionally accessed lead_end[end_len-1], causing potential
underflow when end_len == 0.

This change adds an end_len > 0 guard to ensure we only index lead_end
if there is at least one character.

closes: #17476

Signed-off-by: jinyaoguo <guo846@purdue.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/edit.c
src/version.c