aboutsummaryrefslogtreecommitdiffstats
path: root/dev-util/mfoc/files/mfoc-fix-segfault.patch
blob: 9b66fd231df5bf7f8f2784b680fb6041d2dd7855 (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
30
31
32
--- 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
-  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) {
     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;
 
@@ -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);
   }