libopensc: initialize value returned by sc_select_file

several places in the code expect sc_select_file to set *file_out to NULL
in case of failure. Adjust the function to behave like this.

Fixes #460
This commit is contained in:
Andreas Kemnade 2015-05-11 14:17:54 +02:00 committed by Viktor Tarasov
parent 6a6ef61d1a
commit a09ca246a7
1 changed files with 3 additions and 0 deletions

View File

@ -475,6 +475,9 @@ iso7816_select_file(struct sc_card *card, const struct sc_path *in_path, struct
pathlen = in_path->len;
pathtype = in_path->type;
if (file_out != NULL) {
*file_out = NULL;
}
if (in_path->aid.len) {
if (!pathlen) {
memcpy(path, in_path->aid.value, in_path->aid.len);