From bcca2f530d462ab57b1359ae8a39ad07f1162def Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 7 Jul 2016 09:25:57 +0100 Subject: [PATCH] Do a better job of sanitising the callsign for APRS. --- YSFGateway/APRSWriter.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/YSFGateway/APRSWriter.cpp b/YSFGateway/APRSWriter.cpp index 83751af..35cb6db 100644 --- a/YSFGateway/APRSWriter.cpp +++ b/YSFGateway/APRSWriter.cpp @@ -77,13 +77,8 @@ void CAPRSWriter::write(const unsigned char* source, const char* type, unsigned ::memcpy(callsign, source, YSF_CALLSIGN_LENGTH); callsign[YSF_CALLSIGN_LENGTH] = 0x00U; - char* p = ::strchr(callsign, ' '); - if (p != NULL) - *p = 0x00U; - - p = ::strchr(callsign, '/'); - if (p != NULL) - *p = 0x00U; + size_t n = ::strspn(callsign, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + callsign[n] = 0x00U; double tempLat = ::fabs(fLatitude); double tempLong = ::fabs(fLongitude);