I'd argue for a global replacement of
sprintf(dest, ...) to
snprintf(dest, sizeof(dest)...)Unfortunately, that's probably not an automated task.
from the man page:
The snprintf() and vsnprintf() functions will write at most size-1 of the characters printed
into the output string (the size'th character then gets the terminating ‘\0’); if the return
value is greater than or equal to the size argument, the string was too short and some of the
printed characters were discarded. The output is always null-terminated, unless size is 0.
bonus points for checking the return code :)