]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - login-utils/last.c
last: fix wtmp user name buffer overflow [asan]
[thirdparty/util-linux.git] / login-utils / last.c
index 6b25efd4c6932cbc96080bb971e27121c1099329..be744b079198ecf11ba05eed990c5f942bca18c0 100644 (file)
@@ -600,6 +600,7 @@ static int is_phantom(const struct last_control *ctl, struct utmpx *ut)
 
        if (ut->ut_tv.tv_sec < ctl->boot_time.tv_sec)
                return 1;
+       ut->ut_user[__UT_NAMESIZE - 1] = '\0';
        pw = getpwnam(ut->ut_user);
        if (!pw)
                return 1;