]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
Sanity check number of parameters in an exception record
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 1 Mar 2017 14:00:37 +0000 (14:00 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 1 Mar 2017 14:14:22 +0000 (14:14 +0000)
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

index 759f577f41057d33192d2777c25bd78923267c45..1bcc3e381d7264345b0d13085b865113767937db 100644 (file)
@@ -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,