coredump: do not crash if we failed to acquire exe path
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 3 Jan 2022 08:24:03 +0000 (09:24 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 3 Jan 2022 22:44:44 +0000 (22:44 +0000)
commitc790632cabf5691b0910fc6b7a5c6af31a7786aa
treefc09f8c4f5e67d071d18a006f7a8b0059c1d6ec1
parent73dfeb0c6e34eb28f0cd02bb1a648bddc7931dff
coredump: do not crash if we failed to acquire exe path

The COREDUMP_EXE attribute is "optional", i.e. we continue to process the
crash even if we didn't acquire it. The coredump generation code assumed
that it is always available:

 #5 endswith at ../src/fundamental/string-util-fundamental.c:41
 [ endswith() is called with NULL here, and an assertion fails. ]
 #6 submit_coredump at ../src/coredump/coredump.c:823
 #7 process_socket at ../src/coredump/coredump.c:1038
 #8 run at ../src/coredump/coredump.c:1413

We use the exe path for loop detection, and also (ultimately) pass it to
dwfl_core_file_report(). The latter seems to be fine will NULL, so let's just
change our code to look at COMM, which should be more reliable anyway.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2036517.
src/coredump/coredump.c