diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2017-05-26 20:34:50 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2017-05-26 20:34:50 +0000 |
commit | 1149bf1f993106a70f9b86984f4277fc2ffce11d (patch) | |
tree | 504be2e6be21e4f0d08b44b4c18387aae82833ff /usr.bin/ssh | |
parent | d3eb3b80567aeee7f436b3f7246efc86e6f1769e (diff) |
sshbuf_consume: reset empty buffer; ok djm@
Diffstat (limited to 'usr.bin/ssh')
-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; } |