]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: (dasd) add buffer size guards to helper functions
authorKarel Zak <kzak@redhat.com>
Tue, 19 May 2026 08:12:41 +0000 (10:12 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 19 May 2026 08:32:19 +0000 (10:32 +0200)
commit2e5da71d446831f6c814d6533830c5f87a892660
tree16db2e5813217dd7adef85b811e8b7e7738d3c8f
parent77d06080d94ffd7e9c1154a43cd888cafe52e535
libblkid: (dasd) add buffer size guards to helper functions

Add explicit buffer size parameters to dasd_get_volser(),
dasd_get_dsnam(), is_dasd_cdl_label(), is_dasd_ldl_label()
and is_dasd_f4_label() so that these functions can protect
against buffer overflows without relying on callers to pass
correctly sized buffers.

The conversion functions still follow the DASD standard field
sizes (DASD_VOLSER_LENGTH, sizeof DS1DSNAM), but clamp to the
buffer size as a safety net. The label detection functions
derive their minimum sizes from the actual struct offsets and
magic constants rather than hardcoded numbers.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/dasd.c