Fixes a bug where print_to_buffer() does not correctly handle d_r_vsnprintf()'s return value for the case where the max size is filled up exactly with no room for a null. This bug showed up in the exported disassemble_to_buffer().
Adds tests of these corner cases in disassemble_to_buffer() to api.ir.
Fixes #5833 (closed)