From 03c12a34c58d2550c6c718275950866d387d33f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 22 Sep 2023 20:08:22 +0200 Subject: [PATCH] lslogins: fix realloc() loop allocation size MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If stat() fails the realloc loop would always try to allocate zero bytes. Signed-off-by: Thomas Weißschuh --- login-utils/lslogins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c index 76d28125c9..effaba4b48 100644 --- a/login-utils/lslogins.c +++ b/login-utils/lslogins.c @@ -478,7 +478,7 @@ static struct utmpx *get_last_btmp(struct lslogins_control *ctl, const char *use static int parse_utmpx(const char *path, size_t *nrecords, struct utmpx **records) { - size_t i, imax = 0; + size_t i, imax = 1; struct utmpx *ary = NULL; struct stat st; -- 2.47.3