Skip to content

Commit

Permalink
Refactor buffer length check for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
PhirePhly committed Dec 11, 2016
1 parent d3e006f commit 6d42be8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions digipeater.c
Expand Up @@ -1468,11 +1468,11 @@ static void digipeater_receive_backend(struct digipeater_source *src, struct pbu
}
digi->tokenbucket -= 1.0;

// Log outgoing traffic to the RF log
if (pb->is_aprs && rflogfile) {
int t2l2;
// Essentially Debug logging.. to file

if (sizeof(tbuf) - pb->ax25datalen > t2l && t2l > 0) {
if (sizeof(tbuf) > t2l + pb->ax25datalen && t2l > 0) {
// Have space for body too, skip leading Ctrl+PID bytes
memcpy(tbuf+t2l, pb->ax25data+2, pb->ax25datalen-2); // Ctrl+PID skiped
t2l2 = t2l + pb->ax25datalen-2; // tbuf size sans Ctrl+PID
Expand Down

0 comments on commit 6d42be8

Please sign in to comment.