Replace [v]asprintf with [v]snprintf for better portability

Functions [v]asprintf are not available for strawberry perl
Substitute with better standardized [v]snprintf functions