mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
Marker V2 fixes
This commit is contained in:
parent
bb1c662af0
commit
560b6f9dc2
2 changed files with 11 additions and 19 deletions
|
@ -139,7 +139,7 @@ extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char
|
|||
|
||||
void add_temporary_marker(uint32_t position, const char *label) {
|
||||
if(g_TempMarkerSize == 0) { //Initialize the marker array
|
||||
g_TempMarkers = (marker_t*)malloc(sizeof(marker_t));
|
||||
g_TempMarkers = (marker_t*)calloc(1, sizeof(marker_t));
|
||||
} else { //add more space to the marker array using realloc()
|
||||
marker_t *temp = (marker_t*)realloc(g_TempMarkers, ((g_TempMarkerSize + 1) * sizeof(marker_t)));
|
||||
|
||||
|
@ -155,12 +155,12 @@ void add_temporary_marker(uint32_t position, const char *label) {
|
|||
|
||||
g_TempMarkers[g_TempMarkerSize].pos = position;
|
||||
|
||||
char *markerLabel = (char*)malloc(strlen(label));
|
||||
char *markerLabel = (char*)calloc(1, strlen(label) + 1);
|
||||
strcpy(markerLabel, label);
|
||||
|
||||
if(strlen(markerLabel) > 29) {
|
||||
if(strlen(markerLabel) > 30) {
|
||||
PrintAndLogEx(WARNING, "Label for temporary marker too long! Trunicating...");
|
||||
markerLabel[29] = '\0';
|
||||
markerLabel[30] = '\0';
|
||||
}
|
||||
|
||||
strncpy(g_TempMarkers[g_TempMarkerSize].label, markerLabel, 30);
|
||||
|
|
|
@ -783,8 +783,7 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
|||
char graphText[] = "@%u..%u dt=%i %s zoom=%2.3f";
|
||||
length = ((sizeof(graphText))+(sizeof(uint32_t)*3)+sizeof(scalestr)+sizeof(float_t));
|
||||
|
||||
annotation = (char*)malloc(length);
|
||||
memset(annotation, 0x00, length);
|
||||
annotation = (char*)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, graphText,
|
||||
g_GraphStart,
|
||||
|
@ -805,8 +804,7 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
|||
char gridText[] = "GridX=%lf GridY=%lf (%s) GridXoffset=%lf";
|
||||
length = (sizeof(gridText) + (sizeof(double)*3) + sizeof(gridLocked));
|
||||
|
||||
annotation = (char*)malloc(length);
|
||||
memset(annotation, 0x00, length);
|
||||
annotation = (char*)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, gridText,
|
||||
g_DefaultGridX,
|
||||
|
@ -832,11 +830,8 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
|||
bool flag = false;
|
||||
size_t value;
|
||||
|
||||
annotation = (char*)malloc(length);
|
||||
char *textA = (char*)malloc(length);
|
||||
|
||||
memset(annotation, 0x00, length);
|
||||
memset(textA, 0x00, length);
|
||||
annotation = (char*)calloc(1, length);
|
||||
char *textA = (char*)calloc(1, length);
|
||||
|
||||
strcat(textA, markerText);
|
||||
strcat(textA, " (%s%u)");
|
||||
|
@ -867,8 +862,7 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
|||
length = ((sizeof(markerText))+(sizeof(uint32_t)*2)+1);
|
||||
pos = g_MarkerB.pos;
|
||||
|
||||
annotation = (char*)malloc(length);
|
||||
memset(annotation, 0x00, length);
|
||||
annotation = (char*)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, markerText,
|
||||
"B",
|
||||
|
@ -885,8 +879,7 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
|||
length = ((sizeof(markerText))+(sizeof(uint32_t)*2)+1);
|
||||
pos = g_MarkerC.pos;
|
||||
|
||||
annotation = (char*)malloc(length);
|
||||
memset(annotation, 0x00, length);
|
||||
annotation = (char*)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, markerText,
|
||||
"C",
|
||||
|
@ -903,8 +896,7 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
|||
length = ((sizeof(markerText))+(sizeof(uint32_t)*2)+1);
|
||||
pos = g_MarkerD.pos;
|
||||
|
||||
annotation = (char*)malloc(length);
|
||||
memset(annotation, 0x00, length);
|
||||
annotation = (char*)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, markerText,
|
||||
"D",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue