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.40-rc1~233^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62104e69455c3add88adc360381176f3e83bda28;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 ea5afb5ba6..c624302bd0 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;