Skip to content

libbladeRF: fix buffer overflows and a missing NULL check in gain calibration - #1074

Open
wormuz wants to merge 1 commit into
Nuand:masterfrom
wormuz:fix/gaincal-overflow
Open

libbladeRF: fix buffer overflows and a missing NULL check in gain calibration#1074
wormuz wants to merge 1 commit into
Nuand:masterfrom
wormuz:fix/gaincal-overflow

Conversation

@wormuz

@wormuz wormuz commented Aug 18, 2026

Copy link
Copy Markdown

Three issues in the gain calibration paths added in 2.6.0, all reachable through bladerf_load_gain_calibration() with a caller-controlled path:

device_calibration.cstrcat() appends a caller-supplied CSV path of arbitrary length to a 1000-byte buffer that already holds the working directory. Long paths overflow the stack buffer. Fixed by printing both parts with a format specifier instead of concatenating in place.

bladerf.cstrcpy() copies a caller-supplied calibration path into a PATH_MAX buffer without a length check. Fixed by rejecting paths that do not fit.

bladerf.cmalloc() result passed to strcpy() without a NULL check.

Found while auditing the 2.6.0 changes against a bladeRF 2.0 micro xA4.

@CLAassistant

CLAassistant commented Aug 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…ibration

Three issues in the gain calibration paths added in 2.6.0:

device_calibration.c: strcat() appends a caller-supplied CSV path of
arbitrary length to a 1000-byte buffer that already holds the working
directory. Long paths overflow the stack buffer. Print both parts with
a format specifier instead of concatenating in place.

bladerf.c: strcpy() copies a caller-supplied calibration path into a
PATH_MAX buffer without a length check. Reject paths that do not fit.

bladerf.c: malloc() result used by strcpy() without a NULL check.

All three are reachable through bladerf_load_gain_calibration() with a
caller-controlled path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants