Bugs in dlls/wsock32/socket.c

Juan Lang juan.lang at gmail.com
Sun Nov 4 16:45:41 CST 2007


Hi Gerald,

On Nov 3, 2007 9:58 AM, Gerald Pfeifer <gerald at pfeifer.com> wrote:
> dlls/wsock32/socket.c has the following code:
>
>    DWORD routeTableSize, numRoutes, ndx, ret;
>
>    numRoutes = min(routeTableSize - sizeof(MIB_IPFORWARDTABLE),
>                    0) / sizeof(MIB_IPFORWARDROW) + 1;
>
> The problem here is that both routeTableSize and sizeof(...) are of an
> unsigned type, so their difference is also unsigned.  Which means that
> the minimum between that difference and 0 always will be 0, the result
> of the division will thus always be zero, and the result of the entire
> expressions is a constant 1.
>
> I have a hunch this is not the intendend purpose of this code, is it?

Heh - no, that's not the intended purpose ;)  I'll send a patch.

Thanks,
--Juan



More information about the wine-devel mailing list