zdev: Harden against invalid udev data

Reduce chances of unintended side-effects when importing udev
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-08 16:46:39 +02:00
committed by Jan Höppner
parent 5e93b53f78
commit 3cf95a1d92

View File

@@ -84,7 +84,7 @@ out:
static void get_site_from_line(char *line, int *site, bool *in_site)
{
char site_str[2];
char site_str[3] = { 0 };
if (starts_with(line, SITE_BLOCK_START)) {
memcpy(site_str, line + sizeof(SITE_BLOCK_START), 2);