[prev in list] [next in list] [prev in thread] [next in thread] 

List:       win-pv-devel
Subject:    [win-pv-devel] [PATCH] Sanity check number of parameters in an exception record
From:       Paul Durrant <paul.durrant () citrix ! com>
Date:       2017-03-01 14:15:01
Message-ID: 1488377701-477-1-git-send-email-paul.durrant () citrix ! com
[Download RAW message or body]

When the BugCheck intercept dumps an exception record, make sure that
the number of parameters dumped is no more than the maximum possible
in the record.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
Cc: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 src/xen/bug_check.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/xen/bug_check.c b/src/xen/bug_check.c
index 759f577..1bcc3e3 100644
--- a/src/xen/bug_check.c
+++ b/src/xen/bug_check.c
@@ -32,6 +32,7 @@
 #define XEN_API extern
 
 #include <ntddk.h>
+#include <stdlib.h>
 #include <xen.h>
 #include <bugcodes.h>
 
@@ -63,6 +64,7 @@ BugCheckDumpExceptionRecord(
 {
     __try {
         while (Exception != NULL) {
+            ULONG   NumberParameters;
             ULONG   Index;
 
             LogPrintf(LOG_LEVEL_CRITICAL,
@@ -82,7 +84,10 @@ BugCheckDumpExceptionRecord(
                       __MODULE__,
                       Exception->ExceptionAddress);
 
-            for (Index = 0; Index < Exception->NumberParameters; Index++)
+            NumberParameters = __min(EXCEPTION_MAXIMUM_PARAMETERS,
+                                     Exception->NumberParameters);
+
+            for (Index = 0; Index < NumberParameters; Index++)
                 LogPrintf(LOG_LEVEL_CRITICAL,
                           "%s|BUGCHECK: - Parameter[%u] = %p\n", __MODULE__,
                           Index,
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@lists.xenproject.org
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic