From 6c2240fc6da443624768286ab1b6c29191ce2956 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 6 Jun 2012 21:01:00 +0200 Subject: dev-util/mfoc: fix segfault --- dev-util/mfoc/files/mfoc-fix-segfault.patch | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 dev-util/mfoc/files/mfoc-fix-segfault.patch (limited to 'dev-util/mfoc/files/mfoc-fix-segfault.patch') 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); + } + -- cgit v1.2.3