Fix klocwork warning

Fix possible buffer size overflow error.