diff buffer.c @ 1333:6fafb500de88

reduce buf->pos if shrinking
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 May 2017 23:43:09 +0800
parents 6914eedb1072
children 3fdd8c5a0195 06d52bcb8094
line wrap: on
line diff
--- a/buffer.c	Thu Sep 15 21:43:57 2016 +0800
+++ b/buffer.c	Sat May 13 23:43:09 2017 +0800
@@ -109,6 +109,7 @@
 		dropbear_exit("Bad buf_setlen");
 	}
 	buf->len = len;
+	buf->pos = MIN(buf->pos, buf->len);
 }
 
 /* Increment the length of the buffer */