Log an error when user-Rx buffer is too sort to gain data

This commit is contained in:
Romuald Conty 2012-06-03 21:02:23 +00:00
parent 62c4ffd0b7
commit c7820c6a77

View file

@ -1325,6 +1325,7 @@ pn53x_initiator_transceive_bytes(struct nfc_device *pnd, const uint8_t *pbtTx, c
const size_t szRxLen = (size_t)res - 1; const size_t szRxLen = (size_t)res - 1;
if (pbtRx != NULL) { if (pbtRx != NULL) {
if (szRxLen > szRx) { if (szRxLen > szRx) {
log_put(LOG_CATEGORY, NFC_PRIORITY_ERROR, "Buffer size is too short: %zuo available(s), %zuo needed", szRx, szRxLen);
return NFC_EOVFLOW; return NFC_EOVFLOW;
} }
// Copy the received bytes // Copy the received bytes