Skip to content

Stop header extension iteration on a zero-length extension - #116

Open
Dukotah wants to merge 1 commit into
USNavalResearchLaboratory:masterfrom
Dukotah:fix-zero-length-header-extension
Open

Dukotah wants to merge 1 commit into
USNavalResearchLaboratory:masterfrom
Dukotah:fix-zero-length-header-extension

Conversation

@Dukotah

@Dukotah Dukotah commented Nov 20, 2026

Copy link
Copy Markdown

NormMsg::GetNextExtension() advances to the next extension using the current extension's length field. If a variable-length extension (type < 128) has a length of 0, the offset never advances and the same extension is returned forever. Any while (msg.GetNextExtension(ext)) loop in normNode.cpp and normSession.cpp then never exits. A received message with such an extension is enough to hang the receiving thread.

This treats a zero-length variable-length extension as the end of the extension list. Fixed 4-byte extensions (type 128 and above) are unaffected.

I checked it with a small program that parses a message containing a zero-length extension and loops over GetNextExtension(). Before the change it never terminates. After the change it ends immediately. I haven't tested it over a live session.

Dukotah

A received message whose variable-length header extension (type < 128)
has a zero length field made NormMsg::GetNextExtension() return the
same extension forever, hanging any 'while (GetNextExtension())' loop.
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.

1 participant