dl5di / OpenDV

Open Digital Voice software for Amateur Radio based on Jonathan Naylor's (G4KLX) "ircDDBGateway" and "PCRepeaterController" for D-Star
GNU General Public License v2.0
107 stars 63 forks source link

ircDDBGateway: Fix calculation of APRS passcode #98

Closed mcdermj closed 8 years ago

mcdermj commented 8 years ago

Commit 0c94962 tried to fix the passcode generation of APRS checksums, but failed. The issue is that the C version in Xastir uses a C string that is extra large and includes the terminating NULL at the end. The loop in ircDDBGateway using wxWidgets doesn't have this extra padding at the end. This means that sometimes the loop can try to overflow the string when it's getting the individual characters to calculate the passcode. The last committer changed this so that it would attempt to not overflow the end of the string with an if() statement.

The problem here is that the string is 0 indexed, not 1 indexed. There is an off-by-one error in the if() statement that causes it not to calculate the checksum of the last character in certain cases. This patch should fix that.