← Commit list

9073c1d15

Denys Vlasenko
Denys Vlasenko
2026-09-21
SUCCESS Duration: 219s

Subject

volume_id/romfs: limit the maximum size of label to VOLUME_ID_LABEL_SIZE

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

util-linux/volume_id/romfs.c+2 -2
@@ -44,8 +44,8 @@ int FAST_FUNC volume_id_probe_romfs(struct volume_id *id /*,uint64_t off*/)
if (rfs == NULL)
return -1;
- if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) {
- size_t len = strlen((char *)rfs->name);
+ if (memcmp(rfs->magic, "-rom1fs-", 8) == 0) {
+ size_t len = strnlen((char *)rfs->name, VOLUME_ID_LABEL_SIZE);
if (len) {
// volume_id_set_label_raw(id, rfs->name, len);
util-linux/volume_id/util.c+4 -0
@@ -116,6 +116,10 @@ void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t
{
unsigned i;
+ /* Do not overflow label[VOLUME_ID_LABEL_SIZE+1] */
+ if (count > VOLUME_ID_LABEL_SIZE)
+ count = VOLUME_ID_LABEL_SIZE;
+
memcpy(id->label, buf, count);
/* remove trailing whitespace */