mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
core: don't assert when serializing malformed state
This commit is contained in:
parent
81c4be64da
commit
892eb4d795
@ -1261,22 +1261,24 @@ static int exec_parameters_serialize(const ExecParameters *p, FILE *f, FDSet *fd
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (p->n_socket_fds > 0) {
|
||||
r = serialize_item_format(f, "exec-parameters-n-socket-fds", "%zu", p->n_socket_fds);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
if (p->fds) {
|
||||
if (p->n_socket_fds > 0) {
|
||||
r = serialize_item_format(f, "exec-parameters-n-socket-fds", "%zu", p->n_socket_fds);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (p->n_storage_fds > 0) {
|
||||
r = serialize_item_format(f, "exec-parameters-n-storage-fds", "%zu", p->n_storage_fds);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
if (p->n_storage_fds > 0) {
|
||||
r = serialize_item_format(f, "exec-parameters-n-storage-fds", "%zu", p->n_storage_fds);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (p->n_socket_fds + p->n_storage_fds > 0) {
|
||||
r = serialize_fd_many(f, fds, "exec-parameters-fds", p->fds, p->n_socket_fds + p->n_storage_fds);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (p->n_socket_fds + p->n_storage_fds > 0) {
|
||||
r = serialize_fd_many(f, fds, "exec-parameters-fds", p->fds, p->n_socket_fds + p->n_storage_fds);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
r = serialize_strv(f, "exec-parameters-fd-names", p->fd_names);
|
||||
|
@ -207,7 +207,9 @@ int serialize_item_hexmem(FILE *f, const char *key, const void *p, size_t l) {
|
||||
|
||||
assert(f);
|
||||
assert(key);
|
||||
assert(p || l == 0);
|
||||
|
||||
if (!p && l > 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (l == 0)
|
||||
return 0;
|
||||
@ -230,7 +232,9 @@ int serialize_item_base64mem(FILE *f, const char *key, const void *p, size_t l)
|
||||
|
||||
assert(f);
|
||||
assert(key);
|
||||
assert(p || l == 0);
|
||||
|
||||
if (!p && l > 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (l == 0)
|
||||
return 0;
|
||||
|
3
test/fuzz/fuzz-execute-serialize/crash-395e
Normal file
3
test/fuzz/fuzz-execute-serialize/crash-395e
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
exec-parameters-n-storage-fds=1782
|
3
test/fuzz/fuzz-execute-serialize/crash-622a
Normal file
3
test/fuzz/fuzz-execute-serialize/crash-622a
Normal file
@ -0,0 +1,3 @@
|
||||
exec-context-root-hash=0B12
|
||||
exec-context-root-hash=0B1eÿÿÿÿÿexeec-unx-euucmask=10
|
||||
exec-context-root-hash=0Be-22
|
Loading…
Reference in New Issue
Block a user