
Enable _FORTIFY_SOURCE=3 and Understand What It Checks
Turn on _FORTIFY_SOURCE=3 with -O2 on glibc 2.33 or later and see which libc calls get bounds checks, how level 3 differs from 2 and what it cannot catch.
Everything you need to level up your coding skills.

Turn on _FORTIFY_SOURCE=3 with -O2 on glibc 2.33 or later and see which libc calls get bounds checks, how level 3 differs from 2 and what it cannot catch.

Declare a logging function with __attribute__((format(printf, ...))) so GCC and Clang check each call's format and arguments, and pair it with vsnprintf.

A use-after-free reads or writes memory after free released it. See how it happens in C and C++, how ASan reports it and patterns that stop it.

A heap buffer overflow writes past a malloc block into the next chunk. Learn the common causes in C, how AddressSanitizer and Valgrind find them, and fixes.

A stack canary is a secret value placed before the return address and checked before ret. See how GCC emits it, where glibc stores it, and what it misses.

Replace strcpy, strcat and sprintf in C with snprintf, memcpy with a checked length, and strlcpy, and detect truncation instead of overflowing a buffer.

One byte too few for the terminating NUL is enough to corrupt memory. See the common off-by-one patterns in C strings and how to write them correctly.

A stack buffer overflow writes past a local array into the data next to it. See how it happens in C, what a canary does, and which habits prevent it.

Record a program's system calls with strace, turn the list into a libseccomp allowlist, and test it with a logging default before you switch to kill.

chroot only changes how a process resolves paths, while pivot_root swaps the mount namespace's root and lets you unmount the old one. Why containers need that.

Build a default-deny seccomp allow-list in C with libseccomp, add an argument rule that limits write to one file descriptor, and inspect the generated BPF.

Learn how a microcontroller bootloader starts, validates and updates firmware, from the Cortex-M reset sequence to safe OTA, rollback and secure boot.
We send one email when a new post is published. No spam.