pkcs15init profile: syntax error can provoke segmentation fault

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4080 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
viktor.tarasov 2010-03-03 17:22:01 +00:00
parent 0bb56af014
commit 1bd07bacd6
1 changed files with 4 additions and 1 deletions

View File

@ -2179,5 +2179,8 @@ parse_error(struct state *cur, const char *fmt, ...)
if ((sp = strchr(buffer, '\n')) != NULL)
*sp = '\0';
sc_debug(cur->profile->card->ctx, "%s: %s", cur->filename, buffer);
if (cur->profile->card && cur->profile->card->ctx)
sc_debug(cur->profile->card->ctx, "%s: %s", cur->filename, buffer);
else
fprintf(stdout, "%s: %s\n", cur->filename, buffer);
}