Skip to content

Fix stack buffer overflow in globalerrorhandler::Abort() - #697

Open
anankex wants to merge 1 commit into
Attnam:masterfrom
anankex:fix-abort-overflow
Open

anankex wants to merge 1 commit into
Attnam:masterfrom
anankex:fix-abort-overflow

Conversation

@anankex

@anankex anankex commented Nov 6, 2026

Copy link
Copy Markdown

Abort() formats the message into a 512-byte buffer with vsnprintf() and then appends BugMsg with strcat(). When the message fills the buffer, strcat() writes past its end.

The craft suspension abort fixed in #696 triggers it: the message includes the long recipedata::id() string. AddressSanitizer reports a stack-buffer-overflow in strcat() called from error.cpp:129.

The fix appends BugMsg with snprintf() limited to the space left. A long message now cuts off the tail of BugMsg instead of overflowing.

vsnprintf() can fill the whole 512-byte buffer, and strcat() then
appends BugMsg past its end. Append BugMsg with snprintf() limited to
the space left.
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