Fix the potential buffer overflow

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>