Some specific issues. BIO_snprintf - it's not normal, and "normal" use in the library is wrong! BIO_strdup - it's not normal either (ignores NULL) ERR_add_error_data Induces horrible hacks Replace with asprintf char buf[288 + 1], tmp[20], str[128 + 1];