Fix possible heap-buffer-overflow (#1779)

(cherry picked from commit 4465d88d8eb8a89d4adffb7506393416dd3a964f)
1 file changed