vak: (Default)
Serge Vakulenko ([personal profile] vak) wrote2024-11-16 06:34 pm

Рекомендации от экспертов по Си и Си++

При компиляции кода C или C++ на таких компиляторах, как GCC и clang, включите эти флаги для обнаружения уязвимостей во время компиляции и включения механизмов защиты во время выполнения:
-O2 -Wall -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough \
-Werror=format-security \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 \
-D_GLIBCXX_ASSERTIONS \
-fstrict-flex-arrays=3 \
-fstack-clash-protection -fstack-protector-strong \
-Wl,-z,nodlopen -Wl,-z,noexecstack \
-Wl,-z,relro -Wl,-z,now \
-Wl,--as-needed -Wl,--no-copy-dt-needed-entries
Подробности в статье: "Compiler Options Hardening Guide for C and C++" by the Open Source Security Foundation (OpenSSF) Best Practices Working Group, 2024-10-31.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org