# CVE-2016-2090: freedesktop libbsd heap buffer overflow in fgetwln

Source: https://junglewise.ai/threats/cve-2016-2090-freedesktop-libbsd-heap-buffer-overflow-in-fgetwln  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2017-01-13. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

CVE-2016-2090 · Severity: critical · CVSS 9.8 · Published 2017-01-13

libbsd is a software library that provides common BSD system functions to other operating systems like Linux. A flaw in how it handles memory when reading wide-character strings could allow an attacker to crash applications using this library or potentially execute unauthorized code. This impact depends on how a specific application utilizes the affected library function.

## Quick answers

**Is CVE-2016-2090 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2016-2090 being exploited in the wild.

**How severe is CVE-2016-2090?** Critical severity, with a CVSS score of 9.8, published 13 January 2017.

**Which products and versions are affected?** freedesktop libbsd before 0.8.2.

**Is there a fix for CVE-2016-2090?** A patch was published on 2016-01-27: Fixed in libbsd version 0.8.2 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2016-2090 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2016-2090?** Check whether anything you run is named in the advisory. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

An off-by-one vulnerability exists in the fgetwln() function within libbsd versions prior to 0.8.2. The root cause is an incorrect boundary check in a while loop: the code checks if 'wused > fb->len' before reallocating memory, but fails to account for the case where 'wused == fb->len', leading to an out-of-bounds write of 4 bytes (a wide character) to the heap. While the attack vector is listed as network-reachable, exploitation requires an application to use fgetwln() to process attacker-controlled input. Successful exploitation could result in a heap buffer overflow, potentially leading to arbitrary code execution or a denial-of-service condition. The issue was fixed in libbsd version 0.8.2.

## Affected products

- freedesktop libbsd before 0.8.2

## Timeline

- 2016-01-27: disclosed: Vulnerability reported by Hanno Böck
- 2016-01-27: patched: Fixed in libbsd version 0.8.2
- 2017-01-13: advisory: NVD published CVE-2016-2090

## References

- [http://www.openwall.com/lists/oss-security/2016/01/28/5](http://www.openwall.com/lists/oss-security/2016/01/28/5)
- [https://blog.fuzzing-project.org/36-Heap-buffer-overflow-in-fgetwln-function-of-libbsd.html](https://blog.fuzzing-project.org/36-Heap-buffer-overflow-in-fgetwln-function-of-libbsd.html)
- [https://bugs.freedesktop.org/show_bug.cgi?id=93881](https://bugs.freedesktop.org/show_bug.cgi?id=93881)
- [https://cgit.freedesktop.org/libbsd/commit/?id=c8f0723d2b4520bdd6b9eb7c3e7976de726d7ff7](https://cgit.freedesktop.org/libbsd/commit/?id=c8f0723d2b4520bdd6b9eb7c3e7976de726d7ff7)
- [https://lists.debian.org/debian-lts-announce/2019/12/msg00036.html](https://lists.debian.org/debian-lts-announce/2019/12/msg00036.html)
- [https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7KJE5SPSX7HEKLZ34LUTZLXWPEL2K353/](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7KJE5SPSX7HEKLZ34LUTZLXWPEL2K353/)
- [https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DIQKQ42Z7553D46QY3IMIQKS52QTNIHY/](https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DIQKQ42Z7553D46QY3IMIQKS52QTNIHY/)
