hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ a431930c9bac518bf99d6b1da526a7f37ddee8d8 · < 607217f7ad419b53926f71e3f75001813bbc08ad| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length
check_and_correct_requested_length() compares (off + len) against node_size using u32 arithmetic. When the caller passes a large len value (e.g. from an underflowed subtraction in hfs_brec_remove()), off + len can wrap past 2^32 and produce a small result, causing the bounds check to pass when it should fail.
For example, with off=14 and len=0xFFFFFFF2 (underflowed from data_off - keyoffset - size in hfs_brec_remove), off + len wraps to 6, which is less than a typical node_size of 512, so the check passes and the subsequent memmove reads ~4GB past the node buffer.
Fix this by widening the addition to u64 before comparing against node_size. This prevents the u32 wrap while keeping the logic straightforward.
From the CVE record · Linux
The Linux kernel's hfs/hfsplus length check can overflow when given a large length, allowing a bounds check to pass incorrectly. A subsequent memmove can read far beyond the node buffer. The input does not specify how an attacker can trigger this condition or whether authentication or user interaction is required.
Engineers running Linux kernels with hfs/hfsplus support should check their kernel's status; affected versions are not specified.