diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-10-31 17:02:59 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-10-31 23:09:14 +0100 |
commit | 098c3975acb3df61eedfe471fca27c21f13cf04c (patch) | |
tree | 6c1367ff310e576b35953fcd6dfbcaec139c75e9 /src/coredump | |
parent | coredump: use memory_startswith() when looking at a data blob (diff) | |
download | systemd-098c3975acb3df61eedfe471fca27c21f13cf04c.tar.xz systemd-098c3975acb3df61eedfe471fca27c21f13cf04c.zip |
coredump: make check that all argv[] meta data fields are passed strict
Otherwise, if some field is not supplied we might end up parsing a NULL
string later. Let's catch that early.
Diffstat (limited to 'src/coredump')
-rw-r--r-- | src/coredump/coredump.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index f2acf8c37f..c3e97325e0 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -1045,9 +1045,10 @@ static int context_parse_iovw(Context *context, struct iovec_wrapper *iovw) { memory_startswith(iovec->iov_base, iovec->iov_len, "COREDUMP_SIGNAL_NAME="); } - if (!context->meta[META_ARGV_PID]) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Failed to find the PID of crashing process"); + /* The basic fields from argv[] should always be there, refuse early if not */ + for (int i = 0; i < _META_ARGV_MAX; i++) + if (!context->meta[i]) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "A required (%s) has not been sent, aborting.", meta_field_names[i]); pid_t parsed_pid; r = parse_pid(context->meta[META_ARGV_PID], &parsed_pid); |