Skip to content

Security: bad-antics/nullsec-cppsentry

Security

SECURITY.md

C++ Security Practices Guide

Overview

Secure C++ development practices and vulnerability prevention.

Memory Safety

Smart Pointers

  • unique_ptr ownership
  • shared_ptr reference counting
  • weak_ptr cycle breaking
  • make_unique/make_shared

RAII Pattern

  • Resource acquisition
  • Automatic cleanup
  • Exception safety
  • Scope-based management

Bounds Checking

  • std::array
  • std::span (C++20)
  • at() vs operator[]
  • Range-based iteration

Modern C++ Features

Type Safety

  • std::variant
  • std::optional
  • Strong typedefs
  • enum class

Null Safety

  • nullptr vs NULL
  • Optional returns
  • Reference semantics

Vulnerability Prevention

Buffer Overflows

  • String_view usage
  • Vector bounds
  • Safe string operations

Integer Issues

  • Overflow detection
  • Safe arithmetic
  • Signed/unsigned mixing

Format Strings

  • Type-safe formatting
  • std::format (C++20)
  • Variadic safety

Static Analysis

  • Clang-tidy
  • Cppcheck
  • Coverity
  • PVS-Studio

Compiler Hardening

  • Stack protectors
  • ASLR/PIE
  • Fortify source

Legal Notice

For secure C++ development.

There aren’t any published security advisories