comparison buffer.c @ 1355:3fdd8c5a0195 fuzz

merge main to fuzz
author Matt Johnston <matt@ucc.asn.au>
date Thu, 18 May 2017 23:45:10 +0800
parents ce0931b7f4c2 6fafb500de88
children 665dd8957a67
comparison
equal deleted inserted replaced
1354:7618759e9327 1355:3fdd8c5a0195
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 buf->pos = MIN(buf->pos, buf->len);
113 } 113 }
114 114
115 /* Increment the length of the buffer */ 115 /* Increment the length of the buffer */
116 void buf_incrlen(buffer* buf, unsigned int incr) { 116 void buf_incrlen(buffer* buf, unsigned int incr) {
117 if (incr > BUF_MAX_INCR || buf->len + incr > buf->size) { 117 if (incr > BUF_MAX_INCR || buf->len + incr > buf->size) {