Commit b9e306ee authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

msvcrt: Avoid potential integer overflow when computing median position in bsearch.

parent da6d5e6a
......@@ -139,7 +139,7 @@ void* CDECL MSVCRT_bsearch_s(const void *key, const void *base,
while (min <= max)
{
ssize_t cursor = (min + max) / 2;
ssize_t cursor = min + (max - min) / 2;
int ret = compare(ctx, key,(const char *)base+(cursor*size));
if (!ret)
return (char*)base+(cursor*size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment