summaryrefslogtreecommitdiff
path: root/sshbuf.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2017-05-26 20:34:49 +0000
committerDamien Miller <djm@mindrot.org>2017-05-27 15:35:52 +1000
commit813f55336a24fdfc45e7ed655fccc7d792e8f859 (patch)
treebe0d6bd1be9409353a43b2b6464e5b4d98d3d4f6 /sshbuf.c
parent6cf711752cc2a7ffaad1fb4de18cae65715ed8bb (diff)
downloadopenssh-git-813f55336a24fdfc45e7ed655fccc7d792e8f859.tar.gz
upstream commit
sshbuf_consume: reset empty buffer; ok djm@ Upstream-ID: 0d4583ba57f69e369d38bbd7843d85cac37fa821
Diffstat (limited to 'sshbuf.c')
-rw-r--r--sshbuf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sshbuf.c b/sshbuf.c
index cbf7ed4a..652c99a2 100644
--- a/sshbuf.c
+++ b/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
*
@@ -391,6 +391,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;
}