Blame SOURCES/sudo-1.9.7-utmp-leak.patch
Branch: 34eb9e877efcf656c911a4a0013a68526146554a
34eb9e
From 3fc3a07a03ef74fde99db40ce9ef43ccab336205 Mon Sep 17 00:00:00 2001
34eb9e
From: MertsA <andrewmerts@gmail.com>
34eb9e
Date: Fri, 23 Jul 2021 03:36:05 -0700
34eb9e
Subject: [PATCH] Rewind utmp file pointer after searching for entry
34eb9e
34eb9e
getutline() advances the file pointer until it matches or reaches EOF. pututline() starts from the current position in utmp. This rewinds the file pointer to the beginning to avoid allocating additional spurious utmp entries.
34eb9e
---
34eb9e
src/utmp.c | 1 +
34eb9e
1 file changed, 1 insertion(+)
34eb9e
34eb9e
diff --git a/src/utmp.c b/src/utmp.c
34eb9e
index 544a37519..952bf3043 100644
34eb9e
--- a/src/utmp.c
34eb9e
+++ b/src/utmp.c
34eb9e
@@ -210,6 +210,7 @@ utmp_login(const char *from_line, const char *to_line, int ttyfd,
34eb9e
memset(&utbuf, 0, sizeof(utbuf));
34eb9e
strncpy(utbuf.ut_line, from_line, sizeof(utbuf.ut_line));
34eb9e
ut_old = sudo_getutline(&utbuf);
34eb9e
+ sudo_setutent();
34eb9e
}
34eb9e
utmp_fill(to_line, user, ut_old, &utbuf);
34eb9e
if (sudo_pututline(&utbuf) != NULL)