Fix bad logic in iovlist_truncate().
To conform to RFC 5426, this function is intended to truncate messages if they exceed the message size limits. Unfortunately, the amount of space was computed the wrong way around, causing messages to be truncated entirely. Reported by: Michael Grimm on stable@ MFC after: 3 days
This commit is contained in:
parent
8a3255c288
commit
8803b8597a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335314
@ -1613,8 +1613,8 @@ iovlist_truncate(struct iovlist *il, size_t size)
|
|||||||
struct iovec *last;
|
struct iovec *last;
|
||||||
size_t diff;
|
size_t diff;
|
||||||
|
|
||||||
while (size > il->totalsize) {
|
while (il->totalsize > size) {
|
||||||
diff = size - il->totalsize;
|
diff = il->totalsize - size;
|
||||||
last = &il->iov[il->iovcnt - 1];
|
last = &il->iov[il->iovcnt - 1];
|
||||||
if (diff >= last->iov_len) {
|
if (diff >= last->iov_len) {
|
||||||
/* Remove the last iovec entirely. */
|
/* Remove the last iovec entirely. */
|
||||||
|
Loading…
Reference in New Issue
Block a user