Skip to content

Fix[ntsa::Event::print]: UB on buffer over-read - #402

Open
678098 wants to merge 3 commits into
bloomberg:mainfrom
678098:patch-23
Open

Fix[ntsa::Event::print]: UB on buffer over-read#402
678098 wants to merge 3 commits into
bloomberg:mainfrom
678098:patch-23

Conversation

@678098

@678098 678098 commented May 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

`stateDescription.append("HANGUP", 12)` tries to read 12 bytes from a 6-byte buffer.
stateDescription.append(1, ' ');
}

stateDescription.append("HANGUP", 12);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tries to read 12 bytes, while "HANGUP" is just 6+1 bytes (+null terminator).
bsl::string_view append overload is more safe.
We can also use append(const char *), but it calls strlen each time

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