hfs: fix a potential buffer overflow