Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ACE_Stack_Trace potential buffer overflow. #859

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ACE/ace/Stack_Trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t num_frame
stack_syms = ::backtrace_symbols (stack, stack_size);

for (size_t i = starting_frame;
i < stack_size && num_frames > 0;
i < stack_size && num_frames > 0 && this->buflen_ < SYMBUFSIZ - 1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
i < stack_size && num_frames > 0 && this->buflen_ < SYMBUFSIZ - 1;
i < stack_size && num_frames > 0 && this->buflen_ < SYMBUFSIZ - 2;

Needs space for \n and \0

i++, num_frames--)
{
// this could be more efficient by remembering where we left off in buf_
Expand Down