Previously we'd unconditionally dereference pwd, which can be NULL.
---
toys/other/login.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From 6d4c3ee2d1f4150765c249a737c3eec7699ef0ae Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Mon, 22 Feb 2021 16:46:02 -0800
Subject: [PATCH] login: don't segfault on unknown user.
Previously we'd unconditionally dereference pwd, which can be NULL.
---
toys/other/login.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toys/other/login.c b/toys/other/login.c
index 5214b937..52b973ab 100644
--- a/toys/other/login.c
+++ b/toys/other/login.c
@@ -92,7 +92,7 @@ void login_main(void)
if (x) break;
}
- syslog(LOG_WARNING, "invalid password for '%s' on %s %s%s", pwd->pw_name,
+ syslog(LOG_WARNING, "failed login attempt for '%s' on %s %s%s", username,
ttyname(tty), hh ? "from " : "", hh ? TT.h : "");
sleep(3);
--
2.30.0.617.g56c4b15f3c-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net