[pkg-opensc-commit] [opensc] 25/295: gids bux fixing
Eric Dorland
eric at moszumanska.debian.org
Sat Jun 24 21:11:12 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 0ae4b4ac0d13e596dd4fbf1a9f35c6a5f3a45726
Author: vletoux <vincent.letoux at gmail.com>
Date: Sun May 29 18:55:00 2016 +0200
gids bux fixing
fix the problem if the serial number is entered in the command line
---
src/tools/gids-tool.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/tools/gids-tool.c b/src/tools/gids-tool.c
index 43ef7d4..f3febe6 100644
--- a/src/tools/gids-tool.c
+++ b/src/tools/gids-tool.c
@@ -134,17 +134,19 @@ static int initialize(sc_card_t *card, const char *so_pin, const char *user_pin,
} else {
_serial = (char *)serial;
}
- len = sizeof(param.cardid);
- r = sc_hex_to_bin(_serial, param.cardid, &len);
- if (r < 0) {
- fprintf(stderr, "Error decoding serial number (%s)\n", sc_strerror(r));
- return -1;
- }
- if (len == 0) {
+
+ if (_serial[0] == '\0') {
memset(param.cardid, 0, sizeof(param.cardid));
- } else if (len != 32) {
+ } else if (strlen(_serial) != 32) {
fprintf(stderr, "the serial number must be a hexadecimal string of 32 characters\n");
return -1;
+ } else {
+ len = sizeof(param.cardid);
+ r = sc_hex_to_bin(_serial, param.cardid, &len);
+ if (r < 0) {
+ fprintf(stderr, "Error decoding serial number (%s)\n", sc_strerror(r));
+ return -1;
+ }
}
param.user_pin_len = strlen(_user_pin);
--
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