diff options
Diffstat (limited to 'dev-util/mfoc/files/mfoc-fix-segfault.patch')
-rw-r--r-- | dev-util/mfoc/files/mfoc-fix-segfault.patch | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/dev-util/mfoc/files/mfoc-fix-segfault.patch b/dev-util/mfoc/files/mfoc-fix-segfault.patch index ad09e3b..9b66fd2 100644 --- a/dev-util/mfoc/files/mfoc-fix-segfault.patch +++ b/dev-util/mfoc/files/mfoc-fix-segfault.patch @@ -1,29 +1,32 @@ -Index: src/mifare.c -=================================================================== ---- src/mifare.c (revision 1071) -+++ src/mifare.c (working copy) -@@ -104,7 +104,8 @@ +--- src/mifare.c.orig 2013-12-06 15:29:07.000000000 +0100 ++++ src/mifare.c 2014-10-03 11:00:06.575404505 +0200 +@@ -124,7 +124,8 @@ + return res; } // Fire the mifare command - int res; - if ((res = nfc_initiator_transceive_bytes(pnd, abtCmd, 2 + szParamLen, abtRx, sizeof(abtRx), -1)) < 0) { + size_t abtRxSize = sizeof(abtRx); + if ((res = nfc_initiator_transceive_bytes(pnd, abtCmd, 2 + szParamLen, abtRx, &abtRxSize, -1)) < 0) { - if (res == NFC_ERFTRANS) { - // "Invalid received frame", usual means we are - // authenticated on a sector but the requested MIFARE cmd (read, write) -Index: src/mfoc.c -=================================================================== ---- src/mfoc.c (revision 1071) -+++ src/mfoc.c (working copy) -@@ -690,7 +690,8 @@ - exit (EXIT_FAILURE); - } + return res; + } + +--- src/mfoc.c.orig 2013-12-06 15:29:07.000000000 +0100 ++++ src/mfoc.c 2014-10-03 10:59:23.001537603 +0200 +@@ -706,6 +706,7 @@ + + uint8_t Rx[MAX_FRAME_LEN]; // Tag response + uint8_t RxPar[MAX_FRAME_LEN]; // Tag response ++ size_t RxLen; + + uint32_t Nt, NtLast, NtProbe, NtEnc, Ks1; -- if (nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, sizeof(Rx), 0) < 0) { -+ RxLen = sizeof(Rx); -+ if (nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, &RxLen, 0) < 0) { - fprintf(stdout, "Error while requesting plain tag-nonce\n"); - exit(EXIT_FAILURE); - } - +@@ -731,7 +732,8 @@ + exit(EXIT_FAILURE); + } + +- if (nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, sizeof(Rx), 0) < 0) { ++ RxLen = sizeof(Rx); ++ if (nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, &RxLen, 0) < 0) { + fprintf(stdout, "Error while requesting plain tag-nonce\n"); + exit(EXIT_FAILURE); + } |