Fix off-by-one in username length check

This commit is contained in:
Lauri Kasanen 2023-11-06 13:59:37 +02:00
parent 6cd50869c2
commit 73c3bda8cd
No known key found for this signature in database

View File

@ -1794,7 +1794,7 @@ ws_ctx_t *do_handshake(int sock, char * const ip) {
if (resppw && *resppw)
resppw++;
if (settings.passwdfile) {
if (resppw && *resppw && resppw - response < 32) {
if (resppw && *resppw && resppw - response < USERNAME_LEN + 1) {
char pwbuf[4096];
struct kasmpasswd_t *set = readkasmpasswd(settings.passwdfile);
if (!set->num) {