]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: fix uninitialized variable use
authorLuca Boccassi <luca.boccassi@microsoft.com>
Thu, 20 May 2021 09:35:36 +0000 (10:35 +0100)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Thu, 20 May 2021 09:47:41 +0000 (10:47 +0100)
If the journal file being processed is archivied, seqnum_id will not be
initialized before being passed on, and coverity complains.
Initialize it to zero.

CID #1453235

src/libsystemd/sd-journal/journal-vacuum.c

index 7b57ba5ec3c6cafa5e15e76ce1d0c77a2950d775..494a54d33b16d761ccdf93573c0d1d858cd84f94 100644 (file)
@@ -206,6 +206,9 @@ int journal_directory_vacuum(
                 } else if (endswith(de->d_name, ".journal~")) {
                         unsigned long long tmp;
 
+                        /* seqnum_id won't be initialised before use below, so set to 0 */
+                        seqnum_id = SD_ID128_NULL;
+
                         /* Vacuum corrupted files */
 
                         if (q < 1 + 16 + 1 + 16 + 8 + 1) {