Closed zdohnal closed 8 months ago
@michaelrsweet ok, I made the function public + used _cups_safe_vsnprintf(), which does the job for logging - however it seems there was a bug in the function, which returned shorter string than the maximum possible, and returned higher number of written bytes than it actually wrote.
@michaelrsweet ok, I made the function public + used _cups_safe_vsnprintf(), which does the job for logging - however it seems there was a bug in the function, which returned shorter string than the maximum possible, and returned higher number of written bytes than it actually wrote.
Actually, that is the correct behavior. (v)snprintf
return the number of bytes that would have been written, not the number of bytes written.
Fixes are in master.
No problem, I hope I helped in some way in the end.
@zdohnal For sure, aside from fixing the bug in this function, it also lead to related fixes in the cupsCopy/ConcatString
. And we also promoted the old _cups_safe_snprintf
function to API.
Add the function which will remove the truncated UTF-8 multibyte characters.