pkcs15.c: Check info->label for NULL before calling strdup(). Avoids segmentation fault in the case where info->label == NULL. Fixes #318.

Thanks lmamane.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5125 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
andre 2011-01-27 22:18:16 +00:00
parent 03be594243
commit 13dd004198
1 changed files with 6 additions and 3 deletions

View File

@ -703,9 +703,12 @@ static struct sc_app_info *sc_dup_app_info(const struct sc_app_info *info)
memcpy(out, info, sizeof(struct sc_app_info));
out->label = strdup(info->label);
if (!out->label)
return NULL;
if (info->label) {
out->label = strdup(info->label);
if (!out->label)
return NULL;
} else
out->label = NULL;
out->ddo.value = malloc(info->ddo.len);
if (!out->ddo.value)