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

This commit is contained in:
Frédéric Delanoy 2014-07-03 12:19:25 +02:00 committed by Alexandre Julliard
parent 543314d449
commit ec3a9a54f5

View File

@ -299,7 +299,7 @@ NTDLL_bsearch( const void *key, const void *base, size_t nmemb,
while (min <= max)
{
ssize_t cursor = (min + max) / 2;
ssize_t cursor = min + (max - min) / 2;
int ret = compar(key,(const char *)base+(cursor*size));
if (!ret)
return (char*)base+(cursor*size);