fixed potentially dereferencing null pointer
This commit is contained in:
@@ -588,7 +588,7 @@ static int boxing_pin_cmd_to_buf(sc_context_t *ctx,
|
||||
|
||||
err:
|
||||
free(pinapdu);
|
||||
if (r < 0 && *pc_to_rdr_secure) {
|
||||
if (r < 0 && pc_to_rdr_secure && *pc_to_rdr_secure) {
|
||||
free(*pc_to_rdr_secure);
|
||||
*pc_to_rdr_secure = NULL;
|
||||
}
|
||||
@@ -925,8 +925,9 @@ void sc_detect_boxing_cmds(sc_reader_t *reader)
|
||||
|| apdu.sw2 != 0x00
|
||||
|| boxing_buf_to_pace_capabilities(reader->ctx,
|
||||
apdu.resp, apdu.resplen, &capabilities) != SC_SUCCESS) {
|
||||
sc_debug(reader->ctx, SC_LOG_DEBUG_NORMAL,
|
||||
"%s does not support boxing commands", reader->name);
|
||||
if (reader)
|
||||
sc_debug(reader->ctx, SC_LOG_DEBUG_NORMAL,
|
||||
"%s does not support boxing commands", reader->name);
|
||||
} else {
|
||||
if (capabilities & SC_READER_CAP_PIN_PAD
|
||||
&& !(reader->capabilities & SC_READER_CAP_PIN_PAD)) {
|
||||
|
||||
@@ -219,7 +219,7 @@ static void npa_cache_or_free(sc_card_t *card,
|
||||
{
|
||||
struct npa_drv_data *drv_data;
|
||||
|
||||
if (card->drv_data) {
|
||||
if (card && card->drv_data) {
|
||||
drv_data = card->drv_data;
|
||||
|
||||
if (ef_cardaccess && ef_cardaccess_length
|
||||
|
||||
@@ -1739,7 +1739,10 @@ err:
|
||||
BUF_MEM_clear_free(nonce);
|
||||
BUF_MEM_clear_free(signature);
|
||||
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r);
|
||||
if (card)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r);
|
||||
else
|
||||
return r;
|
||||
}
|
||||
|
||||
static int npa_mse_set_at_ca(sc_card_t *card, int protocol)
|
||||
@@ -1931,7 +1934,10 @@ err:
|
||||
BUF_MEM_clear_free(token);
|
||||
BUF_MEM_clear_free(eph_pub_key);
|
||||
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r);
|
||||
if (card)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r);
|
||||
else
|
||||
return r;
|
||||
}
|
||||
|
||||
static const char *MRZ_name = "MRZ";
|
||||
|
||||
Reference in New Issue
Block a user