vmspawn: tighten parser of EXIT_STATUS=

The EXIT_STATUS is supposed to encapuslate an ANSI C process exit
status, which is 8bit unsigned. Hence parse it as such, do not accept
negative values, or values > 255.
This commit is contained in:
Lennart Poettering
2025-07-08 06:43:17 +02:00
parent ba4624ff6c
commit 5279acb58d
+4 -1
View File
@@ -727,9 +727,12 @@ static int read_vsock_notify(NotifyConnectionData *d, int fd) {
p = strv_find_startswith(tags, "EXIT_STATUS=");
if (p) {
r = safe_atoi(p, d->exit_status);
uint8_t k = 0;
r = safe_atou8(p, &k);
if (r < 0)
log_warning_errno(r, "Failed to parse exit status from %s, ignoring: %m", p);
else
*d->exit_status = k;
}
return 1; /* done */