CVE-2024-49987
bpftool: Fix undefined behavior in qsort(NULL, 0, ...)
Reported by linux · Published October 21, 2024
In the Linux kernel, the following vulnerability has been resolved: bpftool: Fix undefined behavior in qsort(NULL, 0, ...) When netfilter has no entry to display, qsort is called with qsort(NULL, 0, ...). This results in undefined behavior, as UBSan reports: net.c:827:2: runtime error: null pointer passed as argument 1, which is declared to never be null Although the C standard does not explicitly state whether calling qsort with a NULL pointer when the size is 0 constitutes undefined behavior, Section 7.1.4 of the C standard (Use of library functions) mentions: "Each of the following statements applies unless explicitly stated otherwise in the detailed descriptions that follow: If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address space of the program, or a null pointer, or a pointer to non-modifiable storage when the corresponding parameter is not const-qualified) or a type (after promotion) not expected by a function with variable number of arguments, the behavior is undefined." To avoid this, add an early return when nf_link_info is NULL to prevent calling qsort with a NULL pointer.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| linux_kernel | linux | 6.11.3, 6.10.14, 6.6.55 |
Affected products
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | d0fe92fb5e3df6991c640fb9205d880b68603259, d0fe92fb5e3df6991c640fb9205d880b68603259, d0fe92fb5e3df6991c640fb9205d880b68603259 |
| Linux | Linux | 6.4, 0, 6.6.55 |
| Linux | Linux | *, 6.12, 6.4 |
| linux | linux_kernel | 6.4, 6.4, 6.4 |
Timeline
- Oct 21, 2024 CVE Published
- Oct 22, 2024 EPSS Score (30 in total, the first dated here)
- Oct 22, 2024 Coalition ESS Score (7 in total, the first dated here)
- Jan 2, 2026 Security Advisory (436 in total, the first dated here)
- Jan 2, 2026 CVE Updated
- Apr 29, 2026 Distribution Patch (369 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2024-49987
vulnetix vdb fixes CVE-2024-49987
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2024-49987/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart