]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: fix "applying zero offset to null pointer" UBSan error
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 15 May 2024 15:45:06 +0000 (00:45 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 15 May 2024 18:24:03 +0000 (20:24 +0200)
Fixes #32837.

src/systemctl/systemctl-list-unit-files.c

index fc1ad9800abc2c7c79e23617bcb68a949df763d9..b8b1531834f9957c30bf450304d3852b35c7370d 100644 (file)
@@ -79,7 +79,7 @@ static int output_unit_file_list(const UnitFileList *units, unsigned c) {
 
         table_set_ersatz_string(table, TABLE_ERSATZ_DASH);
 
-        for (const UnitFileList *u = units; u < units + c; u++) {
+        FOREACH_ARRAY(u, units, c) {
                 const char *on_underline = NULL, *on_unit_color = NULL, *id;
                 bool underline;