card-jcop: Avoid left-shift of negative values

This commit is contained in:
Jakub Jelen 2019-08-26 13:18:04 +02:00 committed by Frank Morgner
parent 2f643948f1
commit 24eaa3eaa1
1 changed files with 3 additions and 1 deletions

View File

@ -539,7 +539,9 @@ static int jcop_create_file(sc_card_t *card, sc_file_t *file) {
entry = sc_file_get_acl_entry(file, ops[i]);
r = acl_to_ac_nibble(entry);
sec_attr_data[i/2] |= r << ((i % 2) ? 0 : 4);
if (r >= 0) {
sec_attr_data[i/2] |= r << ((i % 2) ? 0 : 4);
}
}
sc_file_set_sec_attr(file, sec_attr_data, 3);