35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
From 62104e69455c3add88adc360381176f3e83bda28 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
|
|
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=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
If stat() fails the realloc loop would always try to allocate zero
|
|
bytes.
|
|
|
|
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
|
Reference:https://github.com/util-linux/util-linux/commit/62104e69455c3add88adc360381176f3e83bda28
|
|
Conflict:NA
|
|
---
|
|
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 ea5afb5ba..c624302bd 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.33.0
|
|
|