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

Attempt to call NULL function #3

Open
cpm64 opened this issue May 6, 2023 · 1 comment
Open

Attempt to call NULL function #3

cpm64 opened this issue May 6, 2023 · 1 comment

Comments

@cpm64
Copy link

cpm64 commented May 6, 2023

Hi,

It seems there is a problem in XNetMaster.cpp @ 546, there is no NULL check before calling notifyXNetFeedback:

for (byte i = 1; i <= len; i++) {
   notifyXNetFeedback((XNetRXBuffer.msg[XNetRXBuffer.get].data[XNetheader+(i*2)-1] << 2) | ((XNetRXBuffer.msg[XNetRXBuffer.get].data[XNetheader+(i*2)] & B110) >> 1), XNetRXBuffer.msg[XNetRXBuffer.get].data[XNetheader+(i*2)]);
}

Everything is fine if the notify is defined, however if not defined it will crash.

Possible fix:

if(notifyXNetFeedback){
  for (byte i = 1; i <= len; i++) {
    notifyXNetFeedback((XNetRXBuffer.msg[XNetRXBuffer.get].data[XNetheader+(i*2)-1] << 2) | ((XNetRXBuffer.msg[XNetRXBuffer.get].data[XNetheader+(i*2)] & B110) >> 1), XNetRXBuffer.msg[XNetRXBuffer.get].data[XNetheader+(i*2)]);
  }
}

Cheers,
CPM

@Digital-MoBa
Copy link
Owner

Fix implementet with v4.1.0

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

2 participants