Mercurial > dropbear
comparison 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 |
comparison
equal
deleted
inserted
replaced
1332:6aaec171e88e | 1333:6fafb500de88 |
---|---|
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 = MIN(buf->pos, buf->len); | |
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) { |