Get the latest tech news

Fixing C Strings


My personal blog about things I find interesting. Hit me up!

I’ve been tinkering in a bare-metal environment recently, writing all code myself, including the common types and routines you find in libc or similar. Overall, I think this is an acceptable tradeoff because format strings are easier to reason about than arbitrary code and all possible issues are localized in calls to print functions. This is what you would expect were the function defined as struct result com_write(u16 port, char *dat, sz len)(indeed, the assembly that’s generated is the same ).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of C Strings

C Strings