]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: make tz use more robust [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 1 Oct 2020 11:44:44 +0000 (13:44 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 1 Oct 2020 11:44:44 +0000 (13:44 +0200)
It's probably unnecessary, but let's make it more robust and keep
static analyzers happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/hwclock-parse-date.y

index 35669fde81cb501f9c19c35f608d2c80079dc866..954bfdc0272b2455199cffb55e5a1d0d37fdd43b 100644 (file)
@@ -1298,8 +1298,8 @@ int parse_date(struct timespec *result, char const *p,
                                        break;
                        } else if (*s == '"') {
                                char *z;
-                               char *tz1;
-                               char tz1buf[TZBUFSIZE];
+                               char *tz1 = NULL;
+                               char tz1buf[TZBUFSIZE] = { '\0' };
                                int large_tz = TZBUFSIZE < tzsize;
                                int setenv_ok;