msvcrt: Avoid potential integer overflow when computing median position in bsearch
Frédéric Delanoy
frederic.delanoy at gmail.com
Sun Jun 29 05:05:36 CDT 2014
---
dlls/msvcrt/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c
index d791699..fc5a5a9 100644
--- a/dlls/msvcrt/misc.c
+++ b/dlls/msvcrt/misc.c
@@ -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);
--
2.0.0
More information about the wine-patches
mailing list