From d9eb90e59b76920046027aaf1ebdc2647795b2c3 Mon Sep 17 00:00:00 2001 From: jgromes Date: Wed, 11 Sep 2024 21:43:24 +0200 Subject: [PATCH] [APRS] Fix callsign in non-LoRa mode and buffer size (#1215) --- src/protocols/APRS/APRS.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/protocols/APRS/APRS.cpp b/src/protocols/APRS/APRS.cpp index 5c54b217..b1f9b5a8 100644 --- a/src/protocols/APRS/APRS.cpp +++ b/src/protocols/APRS/APRS.cpp @@ -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;