Assert input arguments to buf_send() and buf_recv().

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
This commit is contained in:
Pawel Jakub Dawidek 2014-02-02 19:06:00 +00:00
parent 7f7fe890a5
commit 3d34ecea9a

View File

@ -338,6 +338,10 @@ buf_send(int sock, void *buf, size_t size)
ssize_t done;
unsigned char *ptr;
PJDLOG_ASSERT(sock >= 0);
PJDLOG_ASSERT(size > 0);
PJDLOG_ASSERT(buf != NULL);
ptr = buf;
do {
fd_wait(sock, false);
@ -363,6 +367,9 @@ buf_recv(int sock, void *buf, size_t size)
ssize_t done;
unsigned char *ptr;
PJDLOG_ASSERT(sock >= 0);
PJDLOG_ASSERT(buf != NULL);
ptr = buf;
while (size > 0) {
fd_wait(sock, true);