zdev: Harden against invalid hypervisor data

Reduce chances of unintended side-effects when evaluating hypervisor
data which might have been corrupted.

Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2026-07-06 14:21:26 +02:00
committed by Jan Höppner
parent 4ca93aa808
commit a048670bec
3 changed files with 47 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
#include <string.h>
#include <ctype.h>
#include "sanitize.h"
#include "zdev.h"
#include "zdev_id.h"
@@ -69,6 +70,7 @@ static void process_sysinfo(const char *filename)
free(substr);
} else if (sscanf(line, "VM%*d Control Program: %ms ",
&substr) == 1) {
sanitize(substr, VALID_CPNAME);
array_add(&cps, &num_cps, substr);
free(substr);
}