fix stack-buffer-overflow detected by ASAN