Skip to content

Commit

Permalink
comp.c: fix compiler warnings 2
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Mar 26, 2023
1 parent f677e3d commit 5a0f1f4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session,
/* A short-term alloc of a full data chunk is better than a series of
reallocs */
char *out;
size_t out_maxlen = src_len;
size_t out_maxlen;

if(src_len <= SIZE_MAX / 4)
out_maxlen = src_len * 4;
out_maxlen = (uInt)src_len * 4;
else
out_maxlen = payload_limit;

Expand All @@ -247,10 +247,11 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session,
out_maxlen = payload_limit;

strm->next_in = (unsigned char *) src;
strm->avail_in = src_len;
strm->next_out = (unsigned char *) LIBSSH2_ALLOC(session, out_maxlen);
strm->avail_in = (uInt)src_len;
strm->next_out = (unsigned char *) LIBSSH2_ALLOC(session,
(uInt)out_maxlen);
out = (char *) strm->next_out;
strm->avail_out = out_maxlen;
strm->avail_out = (uInt)out_maxlen;
if(!strm->next_out)
return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
"Unable to allocate decompression buffer");
Expand Down Expand Up @@ -299,7 +300,7 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session,
}
out = newout;
strm->next_out = (unsigned char *) out + out_ofs;
strm->avail_out = out_maxlen - out_ofs;
strm->avail_out = (uInt)(out_maxlen - out_ofs);
}

*dest = (unsigned char *) out;
Expand Down

0 comments on commit 5a0f1f4

Please sign in to comment.