fixed potentially dereferencing null pointer

This commit is contained in:
Frank Morgner
2015-01-25 03:53:52 +01:00
parent f03760e27e
commit feebfe7a74
4 changed files with 14 additions and 7 deletions

View File

@@ -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)) {