pkcs15.c: Fixes a bug that occurs in the situation where a PKCS15 EF contains partially invalid data. I.e. the last object in the EF is broken and thus can't be decoded successfully. In that case the whole EF becomes never flagged as enumerated. This in turn results in endless processing of that EF. Thereby the first valid objects became attached to the internal obj_list over and over again.

That patch prevents the repeated attachment of objects to obj_list, because it marks an EF as enumerated as soon the first object was successfully appended.

Left over from #266.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4983 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
andre 2010-12-22 21:45:43 +00:00
parent c514da444e
commit 33a67cac5b
1 changed files with 4 additions and 2 deletions

View File

@ -1598,14 +1598,16 @@ int sc_pkcs15_parse_df(struct sc_pkcs15_card *p15card,
"%s: Error adding object", sc_strerror(r));
goto ret;
}
/* Flag that DF as enumerated, after the first valid object
* was found and the internal obj_list became modified. */
df->enumerated = 1;
};
if (r > 0)
r = 0;
ret:
free(buf);
if (!r)
df->enumerated = 1;
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, r);
}