Sodaq_RN2483 icon indicating copy to clipboard operation
Sodaq_RN2483 copied to clipboard

sendReqAck not working if ACK contains empty payload

Open ghost opened this issue 7 years ago • 0 comments

I believe there is a bug when using sendReqAck if an empty ACK packet is received from the network.

In Sodaq_RN2483::onMacRC() if the ACK packet doesn't contain any payload the last token will be a NULL pointer and subsequently _inputBuffer[inputIndex] will fail.

I propose to add a NULL check after the last strtok and return NoError in such cases.

    // payload
    token = strtok(NULL, " "); // until end of string

    if (!token) {
        debugPrintLn("[onMacRX]: packet contains no payload.");
        return NoError;
    }

ghost avatar Feb 04 '18 11:02 ghost