Reject creating files bigger than 64K.
Most smart cards currently have only 64K or 128K of EEPROM. This will give better errors earlier for people trying to import huge keyfiles with TrueCrypt. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5030 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
0056eeb34c
commit
f8f38e7d86
|
@ -372,6 +372,10 @@ int sc_create_file(sc_card_t *card, sc_file_t *file)
|
|||
|
||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "called; type=%d, path=%s, size=%u",
|
||||
in_path->type, pbuf, file->size);
|
||||
/* ISO 7816-4: "Number of data bytes in the file, including structural information if any"
|
||||
* can not be bigger than two bytes */
|
||||
if (file->size > 0xFFFF)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INVALID_ARGUMENTS);
|
||||
if (card->ops->create_file == NULL)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_NOT_SUPPORTED);
|
||||
r = card->ops->create_file(card, file);
|
||||
|
|
Loading…
Reference in New Issue