mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
BUGS: Coverty Scan, fixes some memory bugs
This commit is contained in:
parent
a198737b44
commit
2696349f16
3 changed files with 6 additions and 5 deletions
|
@ -1892,7 +1892,8 @@ int getSamples(const char *Cmd, bool silent)
|
||||||
PrintAndLog("Unpacking...");
|
PrintAndLog("Unpacking...");
|
||||||
BitstreamOut bout = { got, bits_per_sample * n, 0};
|
BitstreamOut bout = { got, bits_per_sample * n, 0};
|
||||||
int j =0;
|
int j =0;
|
||||||
for (j = 0; j * bits_per_sample < n * 8 && j < sizeof(GraphBuffer); j++) {
|
//for (j = 0; j * bits_per_sample < n * 8 && j < sizeof(GraphBuffer); j++) {
|
||||||
|
for (j = 0; j * bits_per_sample < n * 8 && j < n; j++) {
|
||||||
uint8_t sample = getByte(bits_per_sample, &bout);
|
uint8_t sample = getByte(bits_per_sample, &bout);
|
||||||
GraphBuffer[j] = ((int) sample )- 128;
|
GraphBuffer[j] = ((int) sample )- 128;
|
||||||
}
|
}
|
||||||
|
|
|
@ -547,7 +547,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||||
uint8_t trgKeyType = 0;
|
uint8_t trgKeyType = 0;
|
||||||
uint8_t SectorsCnt = 0;
|
uint8_t SectorsCnt = 0;
|
||||||
uint8_t key[6] = {0, 0, 0, 0, 0, 0};
|
uint8_t key[6] = {0, 0, 0, 0, 0, 0};
|
||||||
uint8_t keyBlock[13*6];
|
uint8_t keyBlock[14*6];
|
||||||
uint64_t key64 = 0;
|
uint64_t key64 = 0;
|
||||||
bool transferToEml = false;
|
bool transferToEml = false;
|
||||||
|
|
||||||
|
@ -1311,7 +1311,7 @@ int CmdHF14AMfESave(const char *Cmd)
|
||||||
for (j = 0; j < 7; j++, fnameptr += 2)
|
for (j = 0; j < 7; j++, fnameptr += 2)
|
||||||
sprintf(fnameptr, "%02X", buf[j]);
|
sprintf(fnameptr, "%02X", buf[j]);
|
||||||
} else {
|
} else {
|
||||||
fnameptr += len;
|
fnameptr += len-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add file extension
|
// add file extension
|
||||||
|
@ -1575,7 +1575,7 @@ int CmdHF14AMfCLoad(const char *Cmd)
|
||||||
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
|
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
|
||||||
|
|
||||||
memcpy(filename, Cmd, len);
|
memcpy(filename, Cmd, len);
|
||||||
fnameptr += len;
|
fnameptr += len-4;
|
||||||
|
|
||||||
sprintf(fnameptr, ".eml");
|
sprintf(fnameptr, ".eml");
|
||||||
|
|
||||||
|
|
|
@ -1113,7 +1113,7 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
sprintf(fnameptr,"%02X%02X%02X%02X%02X%02X%02X.bin",
|
sprintf(fnameptr,"%02X%02X%02X%02X%02X%02X%02X.bin",
|
||||||
data[0], data[1], data[2], data[4], data[5], data[6], data[7]);
|
data[0], data[1], data[2], data[4], data[5], data[6], data[7]);
|
||||||
} else {
|
} else {
|
||||||
sprintf(fnameptr + fileNlen," .bin");
|
sprintf(fnameptr + fileNlen,".bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fout = fopen(filename,"wb")) == NULL) {
|
if ((fout = fopen(filename,"wb")) == NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue