Fix possible buffer overflow.
Merge pull request #1088 from jimis/varfix3

Fix possible buffer overflow.