Skip to content
Snippets Groups Projects
Commit dc6a8901 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Some more Coverity paranoia.

This ones does require SSIZE_MAX... so let's see what the pipes say...
parent 5fd6557c
No related branches found
No related tags found
1 merge request!488Overhaul LZH code
Pipeline #7531 failed
......@@ -189,14 +189,17 @@ off_t sendfilesocket(int sock, int file, off_t *offset, off_t count)
while(total<count) {
rd = read(file, buf, sizeof(buf));
if(rd==-1)
if (rd < 0)
return(-1);
if (rd == 0)
break;
for (i = wr = 0; i < rd; i += wr) {
wr = sendsocket(sock,buf+i,rd-i);
if(wr>0)
if (wr > 0) {
if ((SSIZE_MAX - i) < wr)
wr = SSIZE_MAX - i;
continue;
}
if (wr == SOCKET_ERROR && SOCKET_ERRNO == EWOULDBLOCK) {
wr = 0;
SLEEP(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment