Fix for two apparent C code bugs
By Stanislav Brabec entersafe_init_pin_info() was declared as int, but defined and used as void, resulting in a function returning an unused pseudo-random value. card-gemsafeV1.c uses comparison 'type == "DF"', which is always false, as it compares pointer to a string with pointer to the string "DF" in the code. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3563 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
c89d27f755
commit
ff4d6dd101
|
@ -913,7 +913,7 @@ static int entersafe_decipher(sc_card_t *card,
|
|||
return entersafe_compute_with_prkey(card,crgram,crgram_len,out,outlen);
|
||||
}
|
||||
|
||||
static int entersafe_init_pin_info(struct sc_pin_cmd_pin *pin, unsigned int num)
|
||||
static void entersafe_init_pin_info(struct sc_pin_cmd_pin *pin, unsigned int num)
|
||||
{
|
||||
pin->encoding = SC_PIN_ENCODING_ASCII;
|
||||
pin->min_length = 4;
|
||||
|
|
|
@ -332,7 +332,7 @@ static int gemsafe_process_fci(struct sc_card *card, struct sc_file *file,
|
|||
|
||||
tag = sc_asn1_find_tag(ctx, p, len, 0x8C, &tlen);
|
||||
if (tag) {
|
||||
r = gemsafe_setacl(card, file, tag, type == "DF" ? 1 : 0);
|
||||
r = gemsafe_setacl(card, file, tag, strcmp(type, "DF") ? 0 : 1);
|
||||
if (r < 0) {
|
||||
sc_debug(ctx, "unable to set ACL\n");
|
||||
return SC_ERROR_INTERNAL;
|
||||
|
|
Loading…
Reference in New Issue