Fix: Use an assert to make sure, an error message can be copied into
buffer buf in mch_dirname().

The copied error message is NUL-terminated.