PhirePhly / aprx

A highly configurable APRS I-gate/Digipeater Daemon
http://thelifeofkenneth.com/aprx/
BSD 3-Clause "New" or "Revised" License
155 stars 70 forks source link

ax25_to_tnc() is a little confused about tnc2buf length #58

Closed danak6jq closed 5 years ago

danak6jq commented 5 years ago

Lines 148-153 of ax25.c are:

if (framelen > sizeof(tnc2buf) - 80) {
    /* Too much ! Too much! */
    return 0;
}

where tnc2buf is a function parameter char tnc2buf. sizeof() has 'unsigned int' type, in a 32-bit binary, sizeof(char ) is 4U so this test re-writes as: if (framelen > 4U - 80U) {

which simplifies to: if (framelen > 4294967224) {

Which I'll say is too much! too much! but sadly has nothing to do with the size of the supplied tnc2buf. Perhaps this test yearns to be:

    if (framelen > tnc2buflen) {
danak6jq commented 5 years ago

See issue #57