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

This commit is contained in:
Frédéric Delanoy 2014-06-29 12:05:36 +02:00 committed by Alexandre Julliard
parent da6d5e6ae6
commit b9e306ee78
1 changed files with 1 additions and 1 deletions

View File

@ -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);