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

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

parent 543314d4
......@@ -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);
......
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