The resolver would try to move the bytes in the wire buffer over even if
the incoming data would not fit anyway. This should prevent that.
return protolayer_break(ctx, ret);
}
- /* Try to make space */
- while (len > wire_buf_free_space_length(&tcp->wire_buf)) {
- if (wire_buf_data_length(&tcp->wire_buf) > 0 ||
- tcp->wire_buf.start == 0)
+ /* Check if space can be made */
+ if (len > wire_buf_free_space_length(&tcp->wire_buf)) {
+ if (len > tcp->wire_buf.size - wire_buf_data_length(&tcp->wire_buf))
return protolayer_break(ctx, kr_error(EMSGSIZE));
-
wire_buf_movestart(&tcp->wire_buf);
}