slirp: Make sure to completely initialize the iov on a 0 buffer size return
This commit is contained in:
parent
730af85397
commit
bc40d08b94
1 changed files with 5 additions and 3 deletions
|
@ -93,12 +93,14 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np)
|
||||||
DEBUG_CALL("sopreprbuf");
|
DEBUG_CALL("sopreprbuf");
|
||||||
DEBUG_ARG("so = %lx", (long )so);
|
DEBUG_ARG("so = %lx", (long )so);
|
||||||
|
|
||||||
if (len <= 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
iov[0].iov_base = sb->sb_wptr;
|
iov[0].iov_base = sb->sb_wptr;
|
||||||
iov[1].iov_base = NULL;
|
iov[1].iov_base = NULL;
|
||||||
iov[1].iov_len = 0;
|
iov[1].iov_len = 0;
|
||||||
|
if (np)
|
||||||
|
*np = 1;
|
||||||
|
if (len <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (sb->sb_wptr < sb->sb_rptr) {
|
if (sb->sb_wptr < sb->sb_rptr) {
|
||||||
iov[0].iov_len = sb->sb_rptr - sb->sb_wptr;
|
iov[0].iov_len = sb->sb_rptr - sb->sb_wptr;
|
||||||
/* Should never succeed, but... */
|
/* Should never succeed, but... */
|
||||||
|
|
Loading…
Add table
Reference in a new issue