From: Luca Boccassi Date: Mon, 13 May 2024 23:26:55 +0000 (+0100) Subject: bootctl: fix crash when parsing addon without .cmdline section X-Git-Tag: v256-rc2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c98f2b8167fa3d0d782ddcf51bee40261f40bdcb;p=thirdparty%2Fsystemd.git bootctl: fix crash when parsing addon without .cmdline section Follow-up for 706ca67d3074b2a405ee8fe5de307416e4915b9f --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 42b52c88453..0799191a998 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -783,9 +783,11 @@ static int find_cmdline_section( return 0; r = pe_read_section_data(fd, pe_header, sections, ".cmdline", PE_SECTION_SIZE_MAX, (void**) &cmdline, NULL); - if (r == -ENXIO) /* cmdline is optional */ + if (r == -ENXIO) { /* cmdline is optional */ *ret_cmdline = NULL; - else if (r < 0) + return 0; + } + if (r < 0) return log_warning_errno(r, "Failed to read .cmdline section of '%s': %m", path); word = strdup(cmdline);