Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
danak6jq opened this issue Nov 7, 2019 · 1 comment
Closed

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

danak6jq opened this issue Nov 7, 2019 · 1 comment

Comments

@danak6jq
Copy link

danak6jq commented Nov 7, 2019

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 danak6jq closed this as completed Nov 7, 2019
@danak6jq
Copy link
Author

danak6jq commented Nov 7, 2019

See issue #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant