Fixed buffer overflow

Fixed potential issue where buffer overflow could
occur.