aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhanjinpeng <hanjinpeng@kylinos.cn>2024-08-14 00:56:10 +0800
committerhanjinpeng <hanjinpeng@kylinos.cn>2024-08-14 00:56:10 +0800
commit73e6e18b08f341d1fbda39431ff59c8884f3081b (patch)
treefdae133dd016ef587f6e4d0d69cdd994f0f53fca
parent6e3b38286d3b4953033fe7a1c776d20f06de1cd7 (diff)
downloadtigervnc-73e6e18b08f341d1fbda39431ff59c8884f3081b.tar.gz
tigervnc-73e6e18b08f341d1fbda39431ff59c8884f3081b.zip
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.
-rw-r--r--unix/vncpasswd/vncpasswd.cxx5
1 files changed, 5 insertions, 0 deletions
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<uint8_t> 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);