comparison buffer.c @ 1349:ce0931b7f4c2 fuzz

fix buf->pos when shrinking
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 May 2017 23:44:12 +0800
parents 6914eedb1072
children 3fdd8c5a0195
comparison
equal deleted inserted replaced
1348:5c2899e35b63 1349:ce0931b7f4c2
107 void buf_setlen(buffer* buf, unsigned int len) { 107 void buf_setlen(buffer* buf, unsigned int len) {
108 if (len > buf->size) { 108 if (len > buf->size) {
109 dropbear_exit("Bad buf_setlen"); 109 dropbear_exit("Bad buf_setlen");
110 } 110 }
111 buf->len = len; 111 buf->len = len;
112 buf->pos = 0;
112 } 113 }
113 114
114 /* Increment the length of the buffer */ 115 /* Increment the length of the buffer */
115 void buf_incrlen(buffer* buf, unsigned int incr) { 116 void buf_incrlen(buffer* buf, unsigned int incr) {
116 if (incr > BUF_MAX_INCR || buf->len + incr > buf->size) { 117 if (incr > BUF_MAX_INCR || buf->len + incr > buf->size) {