From 0c505b9e1359a63967cd1ec2a74eaef87e2a1e26 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 10 Oct 2024 21:13:55 +0300 Subject: [PATCH] tar: initialize variables passed to stoint(). Signed-off-by: Andrew Borodin Signed-off-by: Yury V. Zaytsev --- src/vfs/tar/tar-sparse.c | 4 ++-- src/vfs/tar/tar-xheader.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vfs/tar/tar-sparse.c b/src/vfs/tar/tar-sparse.c index 2343f09f8..37ad4b11d 100644 --- a/src/vfs/tar/tar-sparse.c +++ b/src/vfs/tar/tar-sparse.c @@ -253,8 +253,8 @@ static struct tar_sparse_optab const pax_optab = { static gboolean decode_num (uintmax_t *num, const char *arg, uintmax_t maxval) { - char *arg_lim; - gboolean overflow; + char *arg_lim = NULL; + gboolean overflow = FALSE; *num = stoint (arg, &arg_lim, &overflow, 0, maxval); return !(arg_lim == arg || *arg_lim != '\0' || overflow); diff --git a/src/vfs/tar/tar-xheader.c b/src/vfs/tar/tar-xheader.c index 15ec50f24..70d0a03ff 100644 --- a/src/vfs/tar/tar-xheader.c +++ b/src/vfs/tar/tar-xheader.c @@ -255,7 +255,7 @@ static struct timespec decode_timespec (const char *arg, char **arg_lim, gboolean parse_fraction) { int ns = -1; - gboolean overflow; + gboolean overflow = FALSE; time_t s; char const *p; struct timespec r; @@ -341,8 +341,8 @@ static gboolean decode_signed_num (intmax_t *num, const char *arg, intmax_t minval, uintmax_t maxval, const char *keyword) { - char *arg_lim; - gboolean overflow; + char *arg_lim = NULL; + gboolean overflow = FALSE; intmax_t u; (void) keyword; @@ -583,7 +583,7 @@ decode_record (struct xheader *xhdr, char **ptr, char *start = *ptr; char *p = start; idx_t len; - char *len_lim; + char *len_lim = NULL; const char *keyword; char *nextp; idx_t len_max; @@ -802,8 +802,8 @@ sparse_map_decoder (struct tar_stat_info *st, const char *keyword, const char *a while (TRUE) { off_t u; - char *delim; - gboolean overflow; + char *delim = NULL; + gboolean overflow = FALSE; u = stoint (arg, &delim, &overflow, 0, TYPE_MAXIMUM (off_t)); -- 2.11.4.GIT