Fix 'hostuuid: preload data malformed' warning
If the preloaded hostuuid value is invalid and verbose booting is
enabled, a warning is printed. This printf had two bugs:
1. It was missing a trailing \n character.
2. The malformed UUID is printed with %s even though it is not known
to be NUL-terminated.
This commit adds the missing \n and uses %.*s with the (already known)
length of the preloaded UUID to ensure that we don't read past the end
of the buffer.
Reported by: kevans
Fixes: c3188289
Preload hostuuid for early-boot use
MFC after: 3 days
This commit is contained in:
parent
8d2b4b2e7c
commit
330f110bf1
@ -263,8 +263,8 @@ prison0_init(void)
|
||||
(void)strlcpy(prison0.pr_hostuuid, data,
|
||||
size + 1);
|
||||
} else if (bootverbose) {
|
||||
printf("hostuuid: preload data malformed: '%s'",
|
||||
data);
|
||||
printf("hostuuid: preload data malformed: '%.*s'\n",
|
||||
(int)size, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user