wininet: don't evaluate netconn_get_avail_data() twice in netconn_read()

Dan Kegel dank at
Sat Jul 7 19:34:52 CDT 2012

Using netconn_get_avail_data() in min() is funky, don't do it.

min() is a macro which evaluates its right hand argument twice,
which is not only extra work, it also might return different values
on the two calls, leading to min() sometimes returning a
larger value than either of its 'two' inputs.

Also added an assertion that makes the problem obvious.

Thanks to Sami Aario for spotting the overrun.

Fixes and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refill.patch
Type: application/octet-stream
Size: 1655 bytes
Desc: not available
URL: <>

More information about the wine-patches mailing list