While debugging my patch to Asunder I had to compile libcddb and check what happens in cddb_write(). I saw the macro CDDB_WRITE_APPEND and its missing check of the return value of snprintf. I've changed the macro such that it performs the check and returns -1, when 'buf' is too small. At the same time I could get rid of the first parameter so its usage is now much easier.
The patch file is attached.