[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH] Sanity check number of parameters in an exception record



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@xxxxxxxxxx>
Reported-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
---
Cc: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.