Fix unsigned/signed comparison in process_dcc_send1()

The result of read() can be -1, and if that is compared against the unsigned result of sizeof
it will be converted to SIZE_MAX.  Cast the result of sizeof to a signed type.
This commit is contained in:
Kevin Easton
2016-10-20 21:42:10 +11:00
parent e49dfcf11f
commit aacc4b2282

View File

@@ -1850,7 +1850,7 @@ char *buffer = alloca(MAX_DCC_BLOCK_SIZE+1);
} }
if (numbytes) if (numbytes)
{ {
if (read(snum, &bytes, sizeof(u_32int_t)) < sizeof(u_32int_t)) if (read(snum, &bytes, sizeof bytes) < (int)sizeof bytes)
{ {
erase_dcc_info(snum, 1, convert_output_format("$G %RDCC%n Remote closed dcc send", NULL)); erase_dcc_info(snum, 1, convert_output_format("$G %RDCC%n Remote closed dcc send", NULL));
close_socketread(snum); close_socketread(snum);