]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.2.0567: dict function name allocation failure not handled v9.2.0567
authorthinca <thinca@gmail.com>
Sat, 30 May 2026 18:36:34 +0000 (18:36 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 30 May 2026 18:40:55 +0000 (18:40 +0000)
commit2b2dfc4f5a6064efd192c19750b551a01f393e83
treea853e32dfc134ccf5150673f5ff8bb764baf9122
parent22a78b5de72099e6f063dfbc2ab1daebc25f3ae6
patch 9.2.0567: dict function name allocation failure not handled

Problem:  When defining a dictionary function, the function name string
          is allocated with vim_strnsave() but the result is not
          checked. On allocation failure the dict entry is left with
          type VAR_FUNC and a NULL name, and in the overwrite case the
          previous entry has already been freed before the NULL is
          stored.
Solution: Allocate the name before modifying the dict entry and bail out
          on failure, freeing it on all error paths (thinca)

closes: #20376

Co-Authored-by: Claude <noreply@anthropic.com>
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/userfunc.c
src/version.c