Skip to content

[dhcprelay] Replace memset function#12

Merged
yxieca merged 3 commits intosonic-net:masterfrom
maipbui:dhcprelay_replace_memset
Aug 29, 2022
Merged

[dhcprelay] Replace memset function#12
yxieca merged 3 commits intosonic-net:masterfrom
maipbui:dhcprelay_replace_memset

Conversation

@maipbui
Copy link
Copy Markdown
Contributor

@maipbui maipbui commented Aug 21, 2022

Signed-off-by: maipbui [email protected]

Why I did it
Due to compiler optimization: an optimizing compiler, which identifies and removes the function that overwrites the contents as a dead store because the memory is not used subsequently. If sensitive data is in memory, it's dangerous if compiler optimization happens.
Ref:
https://cwe.mitre.org/data/definitions/14.html
https://registry.semgrep.dev/rule/c.lang.security.insecure-use-memset.insecure-use-memset

How I did it
Replace memset() by zero initialization

@maipbui maipbui requested a review from qiluo-msft August 22, 2022 17:44
@maipbui maipbui marked this pull request as ready for review August 23, 2022 14:27
Signed-off-by: maipbui <[email protected]>
@qiluo-msft qiluo-msft requested review from kellyyeh and yxieca August 26, 2022 20:45
@yxieca yxieca merged commit 686099e into sonic-net:master Aug 29, 2022
@maipbui maipbui deleted the dhcprelay_replace_memset branch August 29, 2022 04:43
kellyyeh pushed a commit to kellyyeh/sonic-dhcp-relay that referenced this pull request Oct 8, 2022
Why I did it
memset() is insecure function that can cause buffer overflow

How I did it
Replace memset() by zero initialization

Signed-off-by: maipbui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants