diff options
author | 2017-05-26 20:34:49 +0000 | |
---|---|---|
committer | 2017-05-26 20:34:49 +0000 | |
commit | 49ae696b37a792b0b1d47c5f2d9c2a3232c4aa79 (patch) | |
tree | 47626aa3fd5cc61257858f071097e4b26fbdb403 /usr.bin/ssh/sshbuf.c | |
parent | add a test for the git diffs, suggested by tom (diff) | |
download | wireguard-openbsd-49ae696b37a792b0b1d47c5f2d9c2a3232c4aa79.tar.xz wireguard-openbsd-49ae696b37a792b0b1d47c5f2d9c2a3232c4aa79.zip |
sshbuf_consume: reset empty buffer; ok djm@
Diffstat (limited to 'usr.bin/ssh/sshbuf.c')
-rw-r--r-- | usr.bin/ssh/sshbuf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshbuf.c b/usr.bin/ssh/sshbuf.c index 594ff25500b..e4a4f1e2f25 100644 --- a/usr.bin/ssh/sshbuf.c +++ b/usr.bin/ssh/sshbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshbuf.c,v 1.8 2016/11/25 23:22:04 djm Exp $ */ +/* $OpenBSD: sshbuf.c,v 1.9 2017/05/26 20:34:49 markus Exp $ */ /* * Copyright (c) 2011 Damien Miller * @@ -389,6 +389,9 @@ sshbuf_consume(struct sshbuf *buf, size_t len) if (len > sshbuf_len(buf)) return SSH_ERR_MESSAGE_INCOMPLETE; buf->off += len; + /* deal with empty buffer */ + if (buf->off == buf->size) + buf->off = buf->size = 0; SSHBUF_TELL("done"); return 0; } |