channels/cliprdr: avoid possible integer overflow
authorilammy <a.lozovsky@gmail.com>
Thu, 1 Jun 2017 13:05:07 +0000 (16:05 +0300)
committerilammy <a.lozovsky@gmail.com>
Thu, 1 Jun 2017 13:05:07 +0000 (16:05 +0300)
commit75fa3ad2a03da846258f6a9126f0753541a04eb3
tree3c2e00dfcbfe3b74fa6d84027a8e2a03bb2be130
parent987d7dd88656fa2c6a78781adda32e880a131dba
channels/cliprdr: avoid possible integer overflow

If the server sends us garbage (or the client provides it) then it is
possible for the multiplication to overflow (as it is performed on
unsigned 32-bit values) which will result in a false positive failure of
the sanity check. Avoid it by rearranging arithmetics a little.

Keep the multiplication in the error message because we are interested
in the number of bytes in the stream and how it compares to the number
we have expected based on the presumed file count.
channels/cliprdr/client/cliprdr_format.c