From: Thomas Weißschuh Date: Fri, 22 Sep 2023 18:08:22 +0000 (+0200) Subject: lslogins: fix realloc() loop allocation size X-Git-Tag: v2.39.3~50 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=03c12a34c58d2550c6c718275950866d387d33f5;p=thirdparty%2Futil-linux.git lslogins: fix realloc() loop allocation size If stat() fails the realloc loop would always try to allocate zero bytes. Signed-off-by: Thomas Weißschuh --- 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;