summaryrefslogtreecommitdiffhomepage
path: root/buffer.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2017-05-13 23:43:09 +0800
committerMatt Johnston <matt@ucc.asn.au>2017-05-13 23:43:09 +0800
commit01bde8ff943baaf377cd16748f33e06b512aa22a (patch)
tree8d4b9339a42b667a9b159702731eacc2dee8c1ca /buffer.c
parenteed0e2e431126e06730975ba63cf541068d20f47 (diff)
reduce buf->pos if shrinking
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index d646c0e..0ca50b4 100644
--- a/buffer.c
+++ b/buffer.c
@@ -109,6 +109,7 @@ void buf_setlen(buffer* buf, unsigned int len) {
dropbear_exit("Bad buf_setlen");
}
buf->len = len;
+ buf->pos = MIN(buf->pos, buf->len);
}
/* Increment the length of the buffer */