int rc = hex_modhex_decode(access_code, &access_code_len,
optarg, strlen(optarg),
12, 12, false);
- if (rc < 0) {
+ if (rc <= 0) {
fprintf(stderr,
"Invalid access code string: %s\n",
optarg);
int rc = hex_modhex_decode(fixedbin, &fixedbinlen,
fixed, fixedlen,
0, 16, true);
- if (rc < 0) {
+ if (rc <= 0) {
fprintf(stderr,
"Invalid fixed string: %s\n",
fixed);
goto err;
}
ykp_set_fixed(cfg, fixedbin, fixedbinlen);
- new_access_code = true;
}
else if (strncmp(optarg, "uid=", 4) == 0) {
const char *uid = optarg+4;
int rc = hex_modhex_decode(uidbin, &uidbinlen,
uid, uidlen,
12, 12, false);
- if (rc < 0) {
+ if (rc <= 0) {
fprintf(stderr,
"Invalid uid string: %s\n",
uid);
int rc = hex_modhex_decode (accbin, &accbinlen,
acc, acclen,
12, 12, false);
- if (rc < 0) {
+ if (rc <= 0) {
fprintf(stderr,
"Invalid access code string: %s\n",
acc);
goto err;
}
ykp_set_access_code(cfg, accbin, accbinlen);
+ new_access_code = true;
}
else if (strcmp(optarg, "tab-first") == 0)
ykp_set_tktflag_TAB_FIRST(cfg, true);