Fixed UTF-8 passwords for DeviceCommunicationControl to hold up to 20 UTF-8 characters (#767)

This commit is contained in:
Tomasz Kazimierz Motyl
2024-09-19 14:37:36 +01:00
committed by GitHub
parent b9adcc8097
commit f4325f00b5
6 changed files with 40 additions and 5 deletions
+2 -1
View File
@@ -51,7 +51,8 @@ int reinitialize_device_encode(
}
/* password [1] CharacterString (SIZE (1..20)) OPTIONAL */
if (password) {
if ((password->length >= 1) && (password->length <= 20)) {
if ((password->length >= 1) &&
(characterstring_utf8_length(password) <= 20)) {
len = encode_context_character_string(apdu, 1, password);
apdu_len += len;
}