diff options
Diffstat (limited to 'dev-util/mfoc/files/mfoc-fix-segfault.patch')
-rw-r--r-- | dev-util/mfoc/files/mfoc-fix-segfault.patch | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dev-util/mfoc/files/mfoc-fix-segfault.patch b/dev-util/mfoc/files/mfoc-fix-segfault.patch new file mode 100644 index 0000000..ad09e3b --- /dev/null +++ b/dev-util/mfoc/files/mfoc-fix-segfault.patch @@ -0,0 +1,29 @@ +Index: src/mifare.c +=================================================================== +--- src/mifare.c (revision 1071) ++++ src/mifare.c (working copy) +@@ -104,7 +104,8 @@ + } + // 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); + } + +- 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); + } + |