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

[201811][dhcp6relay] a couple memory access protections #9861

Merged
merged 2 commits into from
Jan 28, 2022

Conversation

kellyyeh
Copy link
Contributor

This is a cherry-pick of PR #9851

Why I did it

the strcpy and buffer allocation is not safe, it corrupts 1 byte on the stack. Depending on the memory layout, it may or may not cause issue immediately.
message type is not validated before updating the counter. Which could cause segment fault.

How I did it

Remove the unsafe strcpy, use config->interface.c_str() instead.
Check message type before updating counters.

How to verify it

The issue (1) caused segment fault on a specific platform. The fix was validated there. Issue (2) was precautionary. Added log in case it triggers.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@kellyyeh kellyyeh requested a review from yxieca January 27, 2022 17:29
@kellyyeh kellyyeh merged commit 94e5749 into sonic-net:201811 Jan 28, 2022
@kellyyeh kellyyeh deleted the 201811-dhcp6relay-buffer branch January 28, 2022 07:18
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.

2 participants