summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/knownhosts.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/knownhosts.rs b/src/knownhosts.rs
index e8355c4..4a6c78d 100644
--- a/src/knownhosts.rs
+++ b/src/knownhosts.rs
@@ -117,7 +117,8 @@ impl<'sess> KnownHosts<'sess> {
&mut outlen,
kind as c_int);
if rc == raw::LIBSSH2_ERROR_BUFFER_TOO_SMALL {
- v.reserve(outlen as usize);
+ // + 1 for the trailing zero
+ v.reserve(outlen as usize + 1);
} else {
try!(self.sess.rc(rc));
v.set_len(outlen as usize);