fix clearing out tempOutput in coprocessor, use memcpy vs strncpy for taking the values from the serial port. create new release

This commit is contained in:
camh 2022-02-23 22:34:44 -08:00
parent a961612de3
commit cd226cec7f
4 changed files with 7 additions and 2 deletions

View File

@ -225,6 +225,7 @@ void readSerialPort(char* output) {
// make sure output variable is clear
memset(output, '\0', MAX_RECEIVE_SIZE);
memset(tempOutput, '\0', MAX_RECEIVE_SIZE);
bool done = false;
long int totalByteCount = 0;
@ -326,7 +327,7 @@ void readSerialPort(char* output) {
#ifdef DEBUGGING
writeSerialPortDebug(boutRefNum, "done building temp output\n");
writeSerialPortDebug(boutRefNum, "done building temp output");
writeSerialPortDebug(boutRefNum, tempOutput);
// char debugOutput[255];
@ -343,7 +344,7 @@ void readSerialPort(char* output) {
}
// attach the gathered up output from the buffer to the output variable
strncat(output, tempOutput, totalByteCount);
memcpy(output, tempOutput, totalByteCount);
#ifdef DEBUGGING
writeSerialPortDebug(boutRefNum, "coprocessor.readSerialPort complete, output:");

Binary file not shown.

Binary file not shown.

View File

@ -17,6 +17,10 @@
// based on https://github.com/mr21/strsplit.c/blob/master/strsplit.c
static char** _strsplit( const char* s, const char* delim, int* nb ) {
#ifdef DEBUG_FUNCTION_CALLS
writeSerialPortDebug(boutRefNum, "DEBUG_FUNCTION_CALLS: _strsplit");
#endif
void* data;
char* _s = ( char* )s;
const char** ptrs;