reqs: Fix CID 1130968 - unchecked return value from library
Check the return code of fcntl via socket_nonblocking
in pull_client_data()
Found by coverity.
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 9efa5799f0
)
This commit is contained in:
parent
6c8d9de3cc
commit
e1af5ffa58
@ -500,6 +500,7 @@ static int pull_client_data (struct conn_s *connptr, long int length)
|
|||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
int ret;
|
||||||
|
|
||||||
buffer =
|
buffer =
|
||||||
(char *) safemalloc (min (MAXBUFFSIZE, (unsigned long int) length));
|
(char *) safemalloc (min (MAXBUFFSIZE, (unsigned long int) length));
|
||||||
@ -525,7 +526,13 @@ static int pull_client_data (struct conn_s *connptr, long int length)
|
|||||||
* return and line feed) at the end of a POST message. These
|
* return and line feed) at the end of a POST message. These
|
||||||
* need to be eaten for tinyproxy to work correctly.
|
* need to be eaten for tinyproxy to work correctly.
|
||||||
*/
|
*/
|
||||||
socket_nonblocking (connptr->client_fd);
|
ret = socket_nonblocking (connptr->client_fd);
|
||||||
|
if (ret != 0) {
|
||||||
|
log_message(LOG_ERR, "Failed to set the client socket "
|
||||||
|
"to non-blocking: %s", strerror(errno));
|
||||||
|
goto ERROR_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
len = recv (connptr->client_fd, buffer, 2, MSG_PEEK);
|
len = recv (connptr->client_fd, buffer, 2, MSG_PEEK);
|
||||||
|
|
||||||
ret = socket_blocking (connptr->client_fd);
|
ret = socket_blocking (connptr->client_fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user