slirp: Make sure to completely initialize the iov on a 0 buffer size return

This commit is contained in:
Mark Pizzolato 2021-08-17 15:21:09 -07:00
parent 730af85397
commit bc40d08b94

View file

@ -93,12 +93,14 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np)
DEBUG_CALL("sopreprbuf");
DEBUG_ARG("so = %lx", (long )so);
if (len <= 0)
return 0;
iov[0].iov_base = sb->sb_wptr;
iov[1].iov_base = NULL;
iov[1].iov_len = 0;
if (np)
*np = 1;
if (len <= 0)
return 0;
if (sb->sb_wptr < sb->sb_rptr) {
iov[0].iov_len = sb->sb_rptr - sb->sb_wptr;
/* Should never succeed, but... */