compat/hstrerror: convert sprintf to snprintf