Don't cast second argument of mem_printf_hook (%b) to size_t.
Also treat the given number as unsigned int. Due to the printf hook registration the second argument of mem_printf_hook (if called via printf etc.) is always of type int*. Casting this to a size_t pointer and then dereferencing that as int does not work on big endian machines if int is smaller than size_t (e.g. on ppc64). In order to make this change work if the argument is of a type larger than int, size_t for instance, the second argument for %b has to be casted to (u_)int.
This commit is contained in:
@@ -207,7 +207,8 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
if (dwRecvLength < APDU_STATUS_LEN ||
|
||||
pbRecvBuffer[dwRecvLength-APDU_STATUS_LEN] != APDU_SW1_RESPONSE_DATA)
|
||||
{
|
||||
DBG1(DBG_IKE, "Select MF failed: %b", pbRecvBuffer, dwRecvLength);
|
||||
DBG1(DBG_IKE, "Select MF failed: %b", pbRecvBuffer,
|
||||
(u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -223,7 +224,8 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
if (dwRecvLength < APDU_STATUS_LEN ||
|
||||
pbRecvBuffer[dwRecvLength-APDU_STATUS_LEN] != APDU_SW1_RESPONSE_DATA)
|
||||
{
|
||||
DBG1(DBG_IKE, "Select DF GSM failed: %b", pbRecvBuffer, dwRecvLength);
|
||||
DBG1(DBG_IKE, "Select DF GSM failed: %b", pbRecvBuffer,
|
||||
(u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -239,7 +241,8 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
if (dwRecvLength < APDU_STATUS_LEN ||
|
||||
pbRecvBuffer[dwRecvLength-APDU_STATUS_LEN] != APDU_SW1_RESPONSE_DATA)
|
||||
{
|
||||
DBG1(DBG_IKE, "Select IMSI failed: %b", pbRecvBuffer, dwRecvLength);
|
||||
DBG1(DBG_IKE, "Select IMSI failed: %b", pbRecvBuffer,
|
||||
(u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -255,14 +258,15 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
if (dwRecvLength < APDU_STATUS_LEN ||
|
||||
pbRecvBuffer[dwRecvLength-APDU_STATUS_LEN] != APDU_SW1_SUCCESS)
|
||||
{
|
||||
DBG1(DBG_IKE, "Select IMSI failed: %b", pbRecvBuffer, dwRecvLength);
|
||||
DBG1(DBG_IKE, "Select IMSI failed: %b", pbRecvBuffer,
|
||||
(u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!decode_imsi_ef(pbRecvBuffer, dwRecvLength-APDU_STATUS_LEN, imsi))
|
||||
{
|
||||
DBG1(DBG_IKE, "Couldn't decode IMSI EF: %b",
|
||||
pbRecvBuffer, dwRecvLength);
|
||||
pbRecvBuffer, (u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -288,7 +292,7 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
pbRecvBuffer[dwRecvLength-APDU_STATUS_LEN] != APDU_SW1_RESPONSE_DATA)
|
||||
{
|
||||
DBG1(DBG_IKE, "Run GSM Algorithm failed: %b",
|
||||
pbRecvBuffer, dwRecvLength);
|
||||
pbRecvBuffer, (u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -305,7 +309,8 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
if (dwRecvLength < APDU_STATUS_LEN ||
|
||||
pbRecvBuffer[dwRecvLength-APDU_STATUS_LEN] != APDU_SW1_SUCCESS)
|
||||
{
|
||||
DBG1(DBG_IKE, "Get Response failed: %b", pbRecvBuffer, dwRecvLength);
|
||||
DBG1(DBG_IKE, "Get Response failed: %b", pbRecvBuffer,
|
||||
(u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -320,7 +325,7 @@ METHOD(simaka_card_t, get_triplet, bool,
|
||||
else
|
||||
{
|
||||
DBG1(DBG_IKE, "Get Response incorrect length: %b",
|
||||
pbRecvBuffer, dwRecvLength);
|
||||
pbRecvBuffer, (u_int)dwRecvLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -642,7 +642,7 @@ static job_requeue_t process(int *fdp)
|
||||
DBG2(DBG_CFG, "SMP XML connection closed");
|
||||
return JOB_REQUEUE_NONE;
|
||||
}
|
||||
DBG3(DBG_CFG, "got XML request: %b", buffer, len);
|
||||
DBG3(DBG_CFG, "got XML request: %b", buffer, (u_int)len);
|
||||
|
||||
reader = xmlReaderForMemory(buffer, len, NULL, NULL, 0);
|
||||
if (reader == NULL)
|
||||
|
||||
@@ -235,7 +235,7 @@ static packet_t *receive_packet(private_socket_dynamic_socket_t *this,
|
||||
DBG1(DBG_NET, "receive buffer too small, packet discarded");
|
||||
return NULL;
|
||||
}
|
||||
DBG3(DBG_NET, "received packet %b", buffer, len);
|
||||
DBG3(DBG_NET, "received packet %b", buffer, (u_int)len);
|
||||
|
||||
if (len < MARKER_LEN)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user