aboutsummaryrefslogtreecommitdiffstats
path: root/dev-util/mfoc/files/mfoc-fix-segfault.patch
blob: ad09e3b7477ca15b67840de33295e5ad618d6ab2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
 	}