From 15cdabd474e7c90bc86fc8c1f2a1ca854ea9f6da Mon Sep 17 00:00:00 2001 From: ksjoberg Date: Tue, 6 Apr 2010 13:41:37 +0000 Subject: [PATCH] Fix issue 14: mandemod and lf em4x em410xread crashes the proxmark3 client app This fix is quick-and-dirty since it only reduces the amount of stackspace allocated by changing the data type of the array to uint8_t instead of the 32 bit integers. The reduced number of bits is OK since only (at most) 2 of the available bits are used in each element. At least array bit utilization is improved from 6.66% to 25% :) Large structures such as these should probably be malloc()ed. --- client/cmddata.c | 2 +- client/cmdlfem4x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/cmddata.c b/client/cmddata.c index d27ca18b..5d012199 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -561,7 +561,7 @@ int CmdManchesterDemod(const char *Cmd) /* But it does not work if compiling on WIndows: therefore we just allocate a */ /* large array */ - int BitStream[MAX_GRAPH_TRACE_LEN]; + uint8_t BitStream[MAX_GRAPH_TRACE_LEN]; /* Detect high and lows */ for (i = 0; i < GraphTraceLen; i++) diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 37355ef2..09bd1920 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -34,7 +34,7 @@ int CmdEM410xRead(const char *Cmd) int parity[4]; char id[11]; int retested = 0; - int BitStream[MAX_GRAPH_TRACE_LEN]; + uint8_t BitStream[MAX_GRAPH_TRACE_LEN]; high = low = 0; /* Detect high and lows and clock */ -- 2.39.5