Add password length check

Don't allow setting a too long password.
This commit is contained in:
Cédric Bosdonnat 2015-06-03 16:19:44 +02:00 committed by Christophe Fergeau
parent 3c77eaa1d7
commit 939e643c2a

View File

@ -3503,6 +3503,8 @@ SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *s,
taTicket.expiration_time = now + lifetime;
}
if (passwd != NULL) {
if (strlen(passwd) > SPICE_MAX_PASSWORD_LENGTH)
return -1;
g_strlcpy(taTicket.password, passwd, sizeof(taTicket.password));
} else {
memset(taTicket.password, 0, sizeof(taTicket.password));