Just a little reminder that a cast to (unsigned char) is needed when passing a possibly negative char to ctype functions like isalnum, isspace. Passing anything other than positive or -1 is undefined behaviour, on platforms where char is signed. One way to find them all is to build from time to time with ctype.h include commented out. Static review tools may also help. +#include + while (base64_len && isspace(*base64)) {