Check the return value of snprintf(), otherwise dst may point out-of-bounds when it reaches the end of the dst_buffer (the snprintf() always returns 1 in that case, even if there is not enough space left), and vMAX becomes negative and is passed to snprintf() as a size_t.