From 73e6e18b08f341d1fbda39431ff59c8884f3081b Mon Sep 17 00:00:00 2001 From: hanjinpeng Date: Wed, 14 Aug 2024 00:56:10 +0800 Subject: [PATCH] Limit the maximum length of a password to 8 characters Password should not be greater than 8 characters. Because only 8 valid characters are used. --- unix/vncpasswd/vncpasswd.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unix/vncpasswd/vncpasswd.cxx b/unix/vncpasswd/vncpasswd.cxx index eb8ad037..b067719b 100644 --- a/unix/vncpasswd/vncpasswd.cxx +++ b/unix/vncpasswd/vncpasswd.cxx @@ -149,6 +149,11 @@ static std::vector readpassword() { continue; } + if (first.size() > 8) { + fprintf(stderr,"Password should not be greater than 8 characters\nBecause only 8 valid characters are used - try again\n"); + continue; + } + #ifdef HAVE_PWQUALITY //the function return score of password quality int r = check_passwd_pwquality(passwd); -- 2.39.5