[APRS] Fix callsign in non-LoRa mode and buffer size (#1215)

This commit is contained in:
jgromes 2024-09-11 21:43:24 +02:00
parent 400382b1e7
commit d9eb90e59b

View file

@ -24,6 +24,11 @@ int16_t APRSClient::begin(char sym, char* callsign, uint8_t ssid, bool alt) {
table = '/';
}
// callsign is only processed for LoRa APRS
if(!callsign) {
return(RADIOLIB_ERR_NONE);
}
if(strlen(callsign) > RADIOLIB_AX25_MAX_CALLSIGN_LEN) {
return(RADIOLIB_ERR_INVALID_CALLSIGN);
}
@ -43,7 +48,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
len += strlen(time);
}
#if !RADIOLIB_STATIC_ONLY
char* info = new char[len + 1];
char* info = new char[len + 2];
#else
char info[RADIOLIB_STATIC_ARRAY_SIZE];
#endif
@ -71,6 +76,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
// send the frame
info[len] = '\0';
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("APRS Info: %s, length = %d", (void*)info, info, (int)len);
int16_t state = sendFrame(destCallsign, destSSID, info);
#if !RADIOLIB_STATIC_ONLY
delete[] info;