common_functions: add special handling of sprintf() and snprintf()