Skip to content

Fix ax25SendUFrame stack overflow on U-frame length write - #8

Open
SimonVutov wants to merge 1 commit into
mainfrom
fix/uframe-send-recv-mac
Open

Fix ax25SendUFrame stack overflow on U-frame length write#8
SimonVutov wants to merge 1 commit into
mainfrom
fix/uframe-send-recv-mac

Conversation

@SimonVutov

@SimonVutov SimonVutov commented Jul 22, 2026

Copy link
Copy Markdown

Purpose

Closes UWOrbital/obc-firmware#437

Fixes the Mac-specific uFrameSendRecv* test failures (UWOrbital/obc-firmware#437).

Changes

ax25SendUFrame passed a uint8_t struct member as a uint16_t* to ax25Stuff, causing a 1-byte stack buffer overflow. This was tolerated on Linux but caused SIGABRT on macOS, aborting the obc-interface-tests binary.

The fix writes the stuffed length to a temporary uint16_t before assigning it to the uint8_t length field.

Verified against obc-firmware's test suite. Before the fix, TestAx25SendRecv.uFrameSendRecvConn aborted the test binary; afterwards, all three uFrameSendRecv* tests pass.

Testing

Before the fix (the test aborts on uFrameSendRecvConn):

[----------] 6 tests from TestAx25SendRecv
[ RUN      ] TestAx25SendRecv.iFrameLittleStuff
[       OK ] TestAx25SendRecv.iFrameLittleStuff (0 ms)
[ RUN      ] TestAx25SendRecv.iFrameMaxStuff
[       OK ] TestAx25SendRecv.iFrameMaxStuff (0 ms)
[ RUN      ] TestAx25SendRecv.iFrameSomeStuff
[       OK ] TestAx25SendRecv.iFrameSomeStuff (0 ms)
[ RUN      ] TestAx25SendRecv.uFrameSendRecvConn
1/2 Test #1: obc-interface-tests ..............Subprocess aborted***Exception:   0.43 sec
test 2
    Start 2: obc-firmware-tests

After the fix (all three U-frame tests pass):

[----------] 6 tests from TestAx25SendRecv
[ RUN      ] TestAx25SendRecv.iFrameLittleStuff
[       OK ] TestAx25SendRecv.iFrameLittleStuff (0 ms)
[ RUN      ] TestAx25SendRecv.iFrameMaxStuff
[       OK ] TestAx25SendRecv.iFrameMaxStuff (0 ms)
[ RUN      ] TestAx25SendRecv.iFrameSomeStuff
[       OK ] TestAx25SendRecv.iFrameSomeStuff (0 ms)
[ RUN      ] TestAx25SendRecv.uFrameSendRecvConn
[       OK ] TestAx25SendRecv.uFrameSendRecvConn (0 ms)
[ RUN      ] TestAx25SendRecv.uFrameSendRecvDisc
[       OK ] TestAx25SendRecv.uFrameSendRecvDisc (0 ms)
[ RUN      ] TestAx25SendRecv.uFrameSendRecvAck
[       OK ] TestAx25SendRecv.uFrameSendRecvAck (0 ms)
[----------] 6 tests from TestAx25SendRecv (0 ms total)

@SimonVutov SimonVutov self-assigned this Jul 22, 2026
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

Successfully merging this pull request may close these issues.

UFrameSendRecv test fails on Mac

1 participant