c Posts
A collection of my posts on c
. Whether I'm trying to
build something new or figure out how to break it, these notes, fixes,
and deep dives document my process. I hope you find them useful.
-
My personal log on a classic C vulnerability. This post is a quick cheat sheet on using printf safely to avoid format string exploits.
-
I've been thinking about what C would be like with a Go-style API. This is my early concept for "Supreme C", a library for high-level, safe I/O.
-
I wanted a consistent C build, but
-std=c99
was hiding POSIX functions. Here's a quick look at using_POSIX_C_SOURCE
to solve that. -
A quick C tip I learned for cleaner code. Adjacent string literals are automatically joined by the compiler, which is great for multi-line text.
-
Thinking about how I handle exit statuses in C. On POSIX systems, 0 is success and 1 is failure, so I just use the numbers directly.
-
I always used to cast the result of malloc in C. After digging in, I realized it's not just unneeded, but it can hide serious bugs. Now I do it differently.
-
To keep my C code style consistent, I rely on indent(1). This post just contains a link to my personal configuration profile for the tool.
-
C's strcpy and strcat are risky. Here's my cheat sheet for using their 'n' versions safely to prevent buffer overflows and corrupting memory.