uint8_t *buf;
off_t ofs = 0;
size_t i;
+ size_t remain = ret;
/* we capture it as one single packet */
buf = (uint8_t *)malloc(ret);
}
for (i=0; i < count; i++) {
+ size_t this_time = MIN(remain, vector[i].iov_len);
memcpy(buf + ofs,
vector[i].iov_base,
- vector[i].iov_len);
- ofs += vector[i].iov_len;
+ this_time);
+ ofs += this_time;
+ remain -= this_time;
}
swrap_dump_packet(si, NULL, SWRAP_RECV, buf, ret);
uint8_t *buf;
off_t ofs = 0;
size_t i;
+ size_t remain = ret;
/* we capture it as one single packet */
buf = (uint8_t *)malloc(ret);
}
for (i=0; i < count; i++) {
+ size_t this_time = MIN(remain, vector[i].iov_len);
memcpy(buf + ofs,
vector[i].iov_base,
- vector[i].iov_len);
- ofs += vector[i].iov_len;
+ this_time);
+ ofs += this_time;
+ remain -= this_time;
}
swrap_dump_packet(si, NULL, SWRAP_SEND, buf, ret);