libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Log if removing cork is unsuccessful


From: Václav Pavlín
Subject: [libmicrohttpd] Log if removing cork is unsuccessful
Date: Thu, 10 Jan 2013 10:40:48 +0100

Hi,

I ran Coverity Scan on last version of libmicrohttpd and it found an
unchecked return value of setsockopt when setting and removing TCP_CORK.
>From my understanding of TCP_CORK it won't do much harm if setting of
cork fails, but it might do some if we are not able to remove the cork -
some data might not be sent. 

On the other hand, I don't think the connection should be closed when we
cannot remove the cork, so I just added message to log, so the user is
able to identify the issue. (see the attached patch)

Second thing Coverity is complaining about, is that you can find
always-false condition in file daemon/daemon.c on line 783:

782     left = connection->response->total_size -
connection->response_write_position;
783     if (left > SSIZE_MAX)
784             left = SSIZE_MAX; /* cap at return value limit */

As SSIZE_MAX is the max value of left's type, it can never be greater.
>From the expression assigning value to variable left I would expect left
should not be less than zero. But I am not sure if I got meaning of
total_size and response_write_position completely right.

So my question is if we should not rather check left against zero
instead of SSIZE_MAX?

Attachment: 0001-Check-result-of-setsockopt-and-log-the-error.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]