[pkg-opensc-commit] [opensc] 193/295: Add the final NUL to the CN used for token label
Eric Dorland
eric at moszumanska.debian.org
Sat Jun 24 21:11:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository opensc.
commit 111ba6f555b5afcb10741f65ca26ecac290de7a5
Author: Martin Paljak <martin at martinpaljak.net>
Date: Fri Mar 3 13:58:44 2017 +0200
Add the final NUL to the CN used for token label
Closes https://github.com/OpenSC/OpenSC/pull/985
---
src/libopensc/pkcs15-esteid.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/libopensc/pkcs15-esteid.c b/src/libopensc/pkcs15-esteid.c
index f80cb98..361b252 100644
--- a/src/libopensc/pkcs15-esteid.c
+++ b/src/libopensc/pkcs15-esteid.c
@@ -117,7 +117,13 @@ sc_pkcs15emu_esteid_init (sc_pkcs15_card_t * p15card)
sc_pkcs15_get_name_from_dn(card->ctx, cert->subject,
cert->subject_len, &cn_oid, &cn_name, &cn_len);
if (cn_len > 0) {
- set_string(&p15card->tokeninfo->label, (const char*)cn_name);
+ char *token_name = malloc(cn_len+1);
+ if (token_name) {
+ memcpy(token_name, cn_name, cn_len);
+ token_name[cn_len] = '\0';
+ set_string(&p15card->tokeninfo->label, (const char*)token_name);
+ free(token_name);
+ }
}
free(cn_name);
sc_pkcs15_free_certificate(cert);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git
More information about the pkg-opensc-commit
mailing list