fixed clang --analyze warnings

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@780 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2012-04-24 12:10:44 +00:00
parent 6394a961c2
commit 78fd66c8b5
3 changed files with 16 additions and 13 deletions

View File

@@ -420,7 +420,7 @@ static int
perform_PC_to_RDR_IccPowerOff(const __u8 *in, size_t inlen, __u8 **out, size_t *outlen)
{
const PC_to_RDR_IccPowerOff_t *request = (PC_to_RDR_IccPowerOff_t *) in;
int sc_result;
int sc_result = SC_SUCCESS;
if (!in || !out || !outlen)
return SC_ERROR_INVALID_ARGUMENTS;
@@ -636,15 +636,14 @@ perform_PC_to_RDR_GetParamters(const __u8 *in, size_t inlen, __u8** out, size_t
break;
default:
goto invaliddata;
sc_result = SC_ERROR_INVALID_DATA;
break;
}
invaliddata:
result = realloc(*out, sizeof *result);
if (!result)
return SC_ERROR_OUT_OF_MEMORY;
*out = (__u8 *) result;
sc_result = SC_ERROR_INVALID_DATA;
result = realloc(*out, sizeof *result);
if (!result)
return SC_ERROR_OUT_OF_MEMORY;
*out = (__u8 *) result;
result->bMessageType = 0x82;
result->bSlot = 0;
@@ -930,7 +929,6 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
goto err;
}
pace_input.certificate_description = &abData[parsed];
parsed += pace_input.certificate_description_length;
if (pace_input.certificate_description_length) {
bin_log(ctx, SC_LOG_DEBUG_VERBOSE, "Certificate description",
pace_input.certificate_description,
@@ -1044,7 +1042,6 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
/* Flawfinder: ignore */
memcpy(p, pace_output.id_icc,
pace_output.id_icc_length);
p += pace_output.id_icc_length;
*abDataOutLen =
@@ -1680,6 +1677,8 @@ int ccid_parse_control(struct usb_ctrlrequest *setup, __u8 **outbuf)
r = SC_ERROR_NOT_SUPPORTED;
}
} else {
r = SC_ERROR_INVALID_ARGUMENTS;
}
if (r < 0)

View File

@@ -1589,7 +1589,9 @@ npa_sm_pre_transmit(sc_card_t *card, const struct sm_ctx *ctx,
NPA_MSE_SET_AT_C *msesetat = NULL;
const unsigned char *p;
if (!card || !ctx || !apdu || !ctx->priv_data) {
if (!card)
return SC_ERROR_INVALID_ARGUMENTS;
if(!ctx || !apdu || !ctx->priv_data) {
r = SC_ERROR_INVALID_ARGUMENTS;
goto err;
}
@@ -1787,7 +1789,9 @@ static int
npa_sm_finish(sc_card_t *card, const struct sm_ctx *ctx,
sc_apdu_t *apdu)
{
if (!card || !ctx || !ctx->priv_data || !apdu || !card)
if (!card)
return SC_ERROR_INVALID_ARGUMENTS;
if(!ctx || !ctx->priv_data || !apdu)
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL,
SC_ERROR_INVALID_ARGUMENTS);
struct npa_sm_ctx *eacsmctx = ctx->priv_data;

View File

@@ -202,7 +202,7 @@ IFDHTransmitToICC (DWORD Lun, SCARD_IO_HEADER SendPci, PUCHAR TxBuffer,
(*RxLength) = size;
/* Flawfinder: ignore */
RxBuffer = memcpy(RxBuffer, rapdu, size);
memcpy(RxBuffer, rapdu, size);
free(rapdu);
RecvPci->Protocol = 1;