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

TS-4470: ASAN stack-buffer-overflow when slow log is enabled #721

Merged
merged 1 commit into from
Jun 20, 2016
Merged
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
3 changes: 2 additions & 1 deletion proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6890,7 +6890,8 @@ HttpSM::update_stats()
int offset = 0;
int skip = 0;

t_state.hdr_info.client_request.url_print(url_string, sizeof url_string, &offset, &skip);
t_state.hdr_info.client_request.url_print(url_string, sizeof(url_string), &offset, &skip);
url_string[sizeof(url_string) - 1] = 0; // NULL terminate the string
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be url_string[offset] = 0;?

Copy link
Contributor Author

@bryancall bryancall Jun 21, 2016

Choose a reason for hiding this comment

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

Offset can have a max value of 256 so it would have to be min(sizeof(url_string) - 1, offset)

Copy link
Member

Choose a reason for hiding this comment

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

The int HTTPHdr::url_print(char *buff, int length, int *offset, int *skip) only called here, can we define the output buffer ( buff ) is a '\0' terminated string?


// unique id
char unique_id_string[128] = "";
Expand Down