mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
FIX: Coverity, out-of-bounds write, CID# 121336, s_index should take factor in consideration when looping. Not sure about this one.
FIX: another thing struck me, the g_index wasn't increased, meaning the "un-decimation" always worked on the same first byte of GraphBuffer.
This commit is contained in:
parent
6799b19374
commit
1d42f25fcd
1 changed files with 6 additions and 5 deletions
|
@ -827,19 +827,20 @@ int CmdUndec(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t factor = param_get8ex(Cmd, 0,2, 10);
|
uint8_t factor = param_get8ex(Cmd, 0, 2, 10);
|
||||||
//We have memory, don't we?
|
//We have memory, don't we?
|
||||||
int swap[MAX_GRAPH_TRACE_LEN] = { 0 };
|
int swap[MAX_GRAPH_TRACE_LEN] = { 0 };
|
||||||
uint32_t g_index = 0 ,s_index = 0;
|
uint32_t g_index = 0 ,s_index = 0;
|
||||||
while(g_index < GraphTraceLen && s_index < MAX_GRAPH_TRACE_LEN)
|
while(g_index < GraphTraceLen && s_index + factor < MAX_GRAPH_TRACE_LEN)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(count = 0; count < factor && s_index+count < MAX_GRAPH_TRACE_LEN; count ++)
|
for (count = 0; count < factor && s_index + count < MAX_GRAPH_TRACE_LEN; count++)
|
||||||
swap[s_index+count] = GraphBuffer[g_index];
|
swap[s_index+count] = GraphBuffer[g_index];
|
||||||
s_index+=count;
|
s_index += count;
|
||||||
|
g_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(GraphBuffer,swap, s_index * sizeof(int));
|
memcpy(GraphBuffer, swap, s_index * sizeof(int));
|
||||||
GraphTraceLen = s_index;
|
GraphTraceLen = s_index;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue