Skip to content

Commit 6923b97

Browse files
xhanulikJakuje
authored andcommitted
iso7816.c: Check length of file_ref to prevent buffer overrun
1 parent 86eabd4 commit 6923b97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libopensc/iso7816.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ iso7816_set_security_env(struct sc_card *card,
10031003
*p++ = env->algorithm_ref & 0xFF;
10041004
}
10051005
if (env->flags & SC_SEC_ENV_FILE_REF_PRESENT) {
1006-
if (env->file_ref.len > 0xFF)
1006+
if (env->file_ref.len > SC_MAX_PATH_SIZE)
10071007
return SC_ERROR_INVALID_ARGUMENTS;
10081008
if (sizeof(sbuf) - (p - sbuf) < env->file_ref.len + 2)
10091009
return SC_ERROR_OFFSET_TOO_LARGE;

0 commit comments

Comments
 (0)