mirror of
https://github.com/Proxmark/proxmark3.git
synced 2024-09-21 23:36:51 +08:00
Add checks in em4x50read to avoid segfaults in case loops go over the GraphTraceLen.
This commit is contained in:
parent
890bf4be90
commit
3628c31882
|
@ -301,17 +301,19 @@ static void CmdEM4x50read(char *str)
|
||||||
while(i < GraphTraceLen)
|
while(i < GraphTraceLen)
|
||||||
{
|
{
|
||||||
// measure from low to low
|
// measure from low to low
|
||||||
while(GraphBuffer[i] > low)
|
while((GraphBuffer[i] > low) && (i<GraphTraceLen))
|
||||||
++i;
|
++i;
|
||||||
start= i;
|
start= i;
|
||||||
while(GraphBuffer[i] < high)
|
while((GraphBuffer[i] < high) && (i<GraphTraceLen))
|
||||||
++i;
|
++i;
|
||||||
while(GraphBuffer[i] > low)
|
while((GraphBuffer[i] > low) && (i<GraphTraceLen))
|
||||||
++i;
|
++i;
|
||||||
|
if (j>(MAX_GRAPH_TRACE_LEN/64)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
tmpbuff[j++]= i - start;
|
tmpbuff[j++]= i - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* look for data start - should be 2 pairs of LW (pulses of 192,128) */
|
/* look for data start - should be 2 pairs of LW (pulses of 192,128) */
|
||||||
start= -1;
|
start= -1;
|
||||||
skip= 0;
|
skip= 0;
|
||||||
|
|
Loading…
Reference in a new issue