Commit 2b2dfc4
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 <[email protected]>
Signed-off-by: thinca <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>1 parent 22a78b5 commit 2b2dfc4
2 files changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5612 | 5612 | | |
5613 | 5613 | | |
5614 | 5614 | | |
| 5615 | + | |
| 5616 | + | |
| 5617 | + | |
| 5618 | + | |
| 5619 | + | |
| 5620 | + | |
| 5621 | + | |
5615 | 5622 | | |
5616 | 5623 | | |
5617 | 5624 | | |
5618 | 5625 | | |
5619 | 5626 | | |
5620 | 5627 | | |
| 5628 | + | |
5621 | 5629 | | |
5622 | 5630 | | |
5623 | 5631 | | |
5624 | 5632 | | |
5625 | 5633 | | |
5626 | 5634 | | |
| 5635 | + | |
5627 | 5636 | | |
5628 | 5637 | | |
5629 | 5638 | | |
| |||
5632 | 5641 | | |
5633 | 5642 | | |
5634 | 5643 | | |
5635 | | - | |
| 5644 | + | |
5636 | 5645 | | |
5637 | 5646 | | |
5638 | 5647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
| 732 | + | |
| 733 | + | |
732 | 734 | | |
733 | 735 | | |
734 | 736 | | |
| |||
0 commit comments