]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: don#t mix two forms of stack allocation in one expression 18927/head
authorLennart Poettering <lennart@poettering.net>
Mon, 8 Mar 2021 16:31:47 +0000 (17:31 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 8 Mar 2021 16:31:47 +0000 (17:31 +0100)
It's not necessarily safe to do this, hence don't.

src/shared/dissect-image.c

index aeaa1061fbc128c74629e6ff51bc799428204697..32fff8165bd8d0df0d92adfd790863d2c1763f48 100644 (file)
@@ -2272,7 +2272,9 @@ int dissected_image_acquire_metadata(DissectedImage *m) {
         /* As per the os-release spec, if the image is an extension it will have a file
          * named after the image name in extension-release.d/ */
         if (m->image_name) {
-                char *ext = strjoina("/usr/lib/extension-release.d/extension-release.", m->image_name, "0");
+                char *ext;
+
+                ext = strjoina("/usr/lib/extension-release.d/extension-release.", m->image_name, "0");
                 ext[strlen(ext) - 1] = '\0'; /* Extra \0 for NULSTR_FOREACH using placeholder from above */
                 paths[META_EXTENSION_RELEASE] = ext;
         } else