{"id":"UBUNTU-CVE-2021-21401","details":"Nanopb is a small code-size Protocol Buffers implementation in ansi C. In Nanopb before versions 0.3.9.8 and 0.4.5, decoding a specifically formed message can cause invalid `free()` or `realloc()` calls if the message type contains an `oneof` field, and the `oneof` directly contains both a pointer field and a non-pointer field. If the message data first contains the non-pointer field and then the pointer field, the data of the non-pointer field is incorrectly treated as if it was a pointer value. Such message data rarely occurs in normal messages, but it is a concern when untrusted data is parsed. This has been fixed in versions 0.3.9.8 and 0.4.5. See referenced GitHub Security Advisory for more information including workarounds.","modified":"2026-04-22T12:46:44.902149Z","published":"2021-03-23T18:15:00Z","related":["USN-6121-1"],"upstream":["CVE-2021-21401"],"references":[{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2021-21401"},{"type":"REPORT","url":"https://github.com/nanopb/nanopb/security/advisories/GHSA-7mv5-5mxh-qg88"},{"type":"REPORT","url":"https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261"},{"type":"REPORT","url":"https://github.com/nanopb/nanopb/blob/c9124132a604047d0ef97a09c0e99cd9bed2c818/CHANGELOG.txt#L1"},{"type":"REPORT","url":"https://github.com/nanopb/nanopb/issues/647"},{"type":"ADVISORY","url":"https://ubuntu.com/security/notices/USN-6121-1"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2021-21401"}],"affected":[{"package":{"name":"nanopb","ecosystem":"Ubuntu:Pro:20.04:LTS","purl":"pkg:deb/ubuntu/nanopb@0.4.1-1ubuntu0.1~esm1?arch=source&distro=esm-apps/focal"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.4.1-1ubuntu0.1~esm1"}]}],"versions":["0.4.1-1"],"ecosystem_specific":{"binaries":[{"binary_name":"nanopb","binary_version":"0.4.1-1ubuntu0.1~esm1"}],"availability":"Available with Ubuntu Pro: https://ubuntu.com/pro"},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-21401.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L"},{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L"},{"type":"Ubuntu","score":"medium"}]}