Skip to content

Commit 3b2919b

Browse files
daloicfrankmorgner
authored andcommitted
libopensc: guard NULL tries_left in dtrust PIN info
sc_pkcs15_get_pin_info() passes tries_left == NULL to sc_pin_cmd(). In dtrust_pin_cmd_get_info(), the CAN branch dereferenced tries_left unconditionally, which caused a SIGSEGV during pkcs11-tool -L token enumeration. Guard the write with a NULL check. Fixes OpenSC#3586
1 parent 306a425 commit 3b2919b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libopensc/card-dtrust.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,9 @@ dtrust_pin_cmd_get_info(struct sc_card *card,
609609
switch (data->pin_reference) {
610610
case PACE_PIN_ID_CAN:
611611
/* unlimited number of retries */
612-
*tries_left = -1;
612+
if (tries_left != NULL) {
613+
*tries_left = -1;
614+
}
613615
data->pin1.max_tries = -1;
614616
data->pin1.tries_left = -1;
615617
r = SC_SUCCESS;

0 commit comments

Comments
 (0)