fix read-past-end of buffer for key input (issue 7)
Merge pull request #23 from cisco/master

Take buffer overflow pull requests