Vim < v9.1.0648 has a double-free in dialog_changed()
Description
Double-free vulnerability in Vim's dialog_changed() when saving a modified unnamed buffer, leading to potential crash.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Double-free vulnerability in Vim's dialog_changed() when saving a modified unnamed buffer, leading to potential crash.
Vulnerability
A double-free vulnerability exists in Vim versions prior to v9.1.0648 in the dialog_changed() function. When a user abandons a modified buffer that has no name, Vim prompts the user to save. If the user chooses to save, Vim creates a new Untitled file and sets the buffer name to "Unnamed". During this process, a pointer is freed twice, leading to a double-free and potential heap-use-after-free. The issue is fixed in patch v9.1.0648 [1][2].
Exploitation
An attacker would need to trick a user into opening a crafted file or script that triggers the vulnerable code path. The user must interact by choosing to save a modified unnamed buffer. No special network position or authentication is required beyond local access to Vim. The exploit sequence involves causing Vim to call dialog_changed() with a buffer that has no name, then selecting the save option, which triggers the double-free [1].
Impact
Successful exploitation can lead to a crash of Vim due to heap-use-after-free. In some cases, this could potentially be leveraged for arbitrary code execution, though the advisory notes the primary impact is a crash. The vulnerability is classified as low severity [1].
Mitigation
The vulnerability is fixed in Vim patch v9.1.0648, released on 2024-08-01. Users should update to Vim v9.1.0648 or later. No workaround is available; updating is the recommended mitigation [1][2].
AI Insight generated on May 25, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
29- osv-coords27 versionspkg:deb/ubuntu/vimpkg:rpm/opensuse/vim&distro=openSUSE%20Leap%2015.6pkg:rpm/suse/vim&distro=SUSE%20Enterprise%20Storage%207.1pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP3-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP4-ESPOSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP4-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP5-ESPOSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP5-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.1pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.2pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.3pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.4pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Micro%205.5pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP6pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP7pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015%20SP6pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015%20SP7pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP5-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP3-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP4-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP5-LTSSpkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP3pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP4pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP5pkg:rpm/suse/vim&distro=SUSE%20Linux%20Enterprise%20Server%20LTSS%20Extended%20Security%2012%20SP5pkg:rpm/suse/vim&distro=SUSE%20Manager%20Proxy%204.3pkg:rpm/suse/vim&distro=SUSE%20Manager%20Server%204.3
>= 0+ 26 more
- (no CPE)range: >= 0
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-17.48.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150500.20.27.1
- (no CPE)range: < 9.1.1406-17.48.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
- (no CPE)range: < 9.1.1406-150000.5.75.1
Patches
0No patches discovered yet.
Vulnerability mechanics
Root cause
"The dialog_changed() function in Vim incorrectly frees a pointer twice when handling modified, unnamed buffers."
Attack vector
An attacker can trigger this vulnerability by abandoning a modified buffer that does not have a name. If the user chooses to save the buffer, Vim may attempt to create a new untitled file. During this process, setting the buffer name to 'Unnamed' causes the double-free condition. This can lead to a heap-use-after-free vulnerability, potentially resulting in a crash [ref_id=1].
Affected code
The vulnerability lies within the `dialog_changed()` function in Vim. The specific lines involved in the double-free are related to clearing buffer filenames, particularly when the buffer name is set to 'Unnamed' [ref_id=1, ref_id=2]. The commit details show modifications around lines 197-205 in `ex_cmds.c` [ref_id=2].
What the fix does
The patch introduces a check to prevent the double-free. Specifically, it verifies if `buf->b_sfname` is different from `buf->b_ffname` before clearing `buf->b_sfname`. This ensures that `VIM_CLEAR(buf->b_fname)` and `VIM_CLEAR(buf->b_sfname)` are not called on the same pointer when the buffer name is set to 'Unnamed', thus resolving the double-free vulnerability [ref_id=2].
Preconditions
- inputThe user must abandon a modified buffer that does not have a name.
- inputThe user must choose to save the modified buffer when prompted.
Generated on Jun 7, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2- github.com/vim/vim/commit/b29f4abcd4b3382fa746edd1d0562b7b48cmitrex_refsource_MISC
- github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2fmitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.