backend: Use asprintf() instead of strlen() + sprintf()