summary refs log tree commit diff stats
path: root/slirp/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/src/socket.c')
-rw-r--r--slirp/src/socket.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/slirp/src/socket.c b/slirp/src/socket.c
index f2428a3ae8..bb752fdcae 100644
--- a/slirp/src/socket.c
+++ b/slirp/src/socket.c
@@ -1,8 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
@@ -173,6 +171,7 @@ int
 soread(struct socket *so)
 {
 	int n, nn;
+	size_t buf_len;
 	struct sbuf *sb = &so->so_snd;
 	struct iovec iov[2];
 
@@ -183,7 +182,8 @@ soread(struct socket *so)
 	 * No need to check if there's enough room to read.
 	 * soread wouldn't have been called if there weren't
 	 */
-	sopreprbuf(so, iov, &n);
+	buf_len = sopreprbuf(so, iov, &n);
+	assert(buf_len != 0);
 
 	nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
 	if (nn <= 0) {
@@ -259,6 +259,7 @@ int soreadbuf(struct socket *so, const char *buf, int size)
 	 * No need to check if there's enough room to read.
 	 * soread wouldn't have been called if there weren't
 	 */
+	assert(size > 0);
 	if (sopreprbuf(so, iov, &n) < size)
         goto err;