NULL Pointer Dereference in function vim_regexec_string at regexp.c:2733 in vim/vim
Description
NULL pointer dereference in vim's regexp.c allows denial of service via crafted input, fixed in vim 8.2.4938.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
NULL pointer dereference in vim's regexp.c allows denial of service via crafted input, fixed in vim 8.2.4938.
Vulnerability
A NULL pointer dereference vulnerability exists in the vim_regexec_string function at regexp.c:2733 in Vim versions prior to 8.2.4938. The bug occurs when processing a crafted input that triggers a NULL pointer access, leading to a crash.
Exploitation
An attacker can exploit this vulnerability by providing a specially crafted input to Vim. No authentication or special privileges are required; the attacker only needs to convince a user to open the malicious file or paste the crafted text into Vim.
Impact
Successful exploitation results in a denial of service (application crash) due to the NULL pointer dereference. The crash disrupts the user's editing session but does not allow arbitrary code execution or data exfiltration.
Mitigation
The vulnerability is fixed in Vim version 8.2.4938, released on May 11, 2022. Users should update to this version or later. No workarounds are available; users must apply the patch.
AI Insight generated on May 27, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
3Patches
0No patches discovered yet.
Vulnerability mechanics
Root cause
"Missing NULL pointer check on `rmp->regprog` before calling `fname_match()` in `buflist_match()` allows a NULL pointer dereference when processing an invalid regex pattern."
Attack vector
An attacker can trigger a denial of service by providing a crafted invalid pattern to the `:buf` command (e.g., `buf [0--]\&\zs*\zs*e`). When Vim attempts to match this pattern against buffer file names via `buflist_match()`, the regex program pointer (`rmp->regprog`) is NULL, causing a NULL pointer dereference crash in `vim_regexec_string()` [ref_id=1]. The attack requires the ability to supply a malformed pattern to the `:buf` command.
Affected code
The vulnerability is in the `buflist_match()` function in Vim's source code. The crash occurs when `fname_match()` is called with a `rmp->regprog` pointer that is NULL, leading to a NULL pointer dereference in `vim_regexec_string()` at `regexp.c:2733`.
What the fix does
The patch adds a NULL check for `rmp->regprog` before calling `fname_match()` with the long file name. The fix changes the condition from `if (match == NULL)` to `if (match == NULL && rmp->regprog != NULL)` at the relevant line in `buflist_match()`, preventing the NULL pointer dereference [ref_id=1]. The patch also adds a test case that exercises the invalid pattern to verify the fix.
Preconditions
- inputAttacker must be able to supply a crafted invalid pattern to the :buf command in Vim
Reproduction
The patch includes a test case that reproduces the crash: open a split window (`vsplit 00000000000000000000000000`), then run `silent! buf [0--]\&\zs*\zs*e` [ref_id=1].
Generated on May 27, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
10- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BFAZTAT5CZC2R6KYDYA2HBAVEDSIX6MW/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUPOLEX5GXC733HL4EFYMHFU7NISJJZG/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ODXVYZC5Z4XRRZK7CK6B6IURYVYHA25U/mitrevendor-advisory
- security.gentoo.org/glsa/202208-32mitrevendor-advisory
- security.gentoo.org/glsa/202305-16mitrevendor-advisory
- seclists.org/fulldisclosure/2022/Oct/28mitremailing-list
- seclists.org/fulldisclosure/2022/Oct/41mitremailing-list
- github.com/vim/vim/commit/a59f2dfd0cf9ee1a584d3de5b7c2d47648e79060mitre
- huntr.dev/bounties/a74ba4a4-7a39-4a22-bde3-d2f8ee07b385mitre
- support.apple.com/kb/HT213488mitre
News mentions
0No linked articles in our index yet.