opensc-explorer: detect AID conversion errors in arg_to_path()
Convert arg_to_path() to using the standard sc_hex_to_binary() instead of the local hex2binary(). While at it, return erros on failed conversions. Signed-off-by: Peter Marschall <peter@adpm.de>
This commit is contained in:
parent
c3ba355531
commit
4cc1ab41ff
|
@ -276,8 +276,14 @@ static int arg_to_path(const char *arg, sc_path_t *path, int is_id)
|
||||||
if (strncasecmp(arg, "aid:", strlen("aid:")) == 0) {
|
if (strncasecmp(arg, "aid:", strlen("aid:")) == 0) {
|
||||||
/* DF aid */
|
/* DF aid */
|
||||||
const char *p = arg + strlen("aid:");
|
const char *p = arg + strlen("aid:");
|
||||||
path->len = hex2binary(path->value, sizeof(path->value), p);
|
int r;
|
||||||
|
|
||||||
path->type = SC_PATH_TYPE_DF_NAME;
|
path->type = SC_PATH_TYPE_DF_NAME;
|
||||||
|
path->len = sizeof(path->value);
|
||||||
|
if ((r = sc_hex_to_bin(p, path->value, &path->len)) < 0) {
|
||||||
|
printf("Error parsing AID: %s\n", p);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* file id */
|
/* file id */
|
||||||
unsigned int buf[2];
|
unsigned int buf[2];
|
||||||
|
|
Loading…
Reference in New Issue