Huw Davies : ntdll: Increase the buffer size for processor features and add a check to catch future overflows .

Alexandre Julliard julliard at winehq.org
Wed Jul 11 17:39:19 CDT 2012


Module: wine
Branch: master
Commit: 760f487f6cbda0dc9f15403c987cfc68ec9bc134
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=760f487f6cbda0dc9f15403c987cfc68ec9bc134

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Jul 11 11:46:14 2012 +0100

ntdll: Increase the buffer size for processor features and add a check to catch future overflows.

---

 dlls/ntdll/nt.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 6d6e0b0..4b3f83a 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1217,7 +1217,7 @@ void fill_cpu_info(void)
         unsigned long long longVal;
         int value;
         int cputype;
-        char buffer[256];
+        char buffer[1024];
 
         valSize = sizeof(int);
         if (sysctlbyname ("hw.optional.floatingpoint", &value, &valSize, NULL, 0) == 0)
@@ -1280,6 +1280,7 @@ void fill_cpu_info(void)
                 if (sysctlbyname ("machdep.cpu.features", buffer, &valSize, NULL, 0) == 0)
                 {
                     cached_sci.Revision |= value;
+                    if (!valSize) FIXME("Buffer not large enough, please increase\n");
                     if (strstr(buffer, "CX8"))   user_shared_data->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
                     if (strstr(buffer, "CX16"))  user_shared_data->ProcessorFeatures[PF_COMPARE_EXCHANGE128] = TRUE;
                     if (strstr(buffer, "MMX"))   user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;




More information about the wine-cvs mailing list