init: fix potential buffer overrun in make_filename()