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

[win-pv-devel] [PATCH 20/20] IoctlLog handler shouldnt be in with the store IOCTLs, and dont fail on /n/r in log messages



Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xeniface/ioctl_store.c | 29 ----------------------------
 src/xeniface/ioctls.c      | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/src/xeniface/ioctl_store.c b/src/xeniface/ioctl_store.c
index f1c816b..5bd4649 100644
--- a/src/xeniface/ioctl_store.c
+++ b/src/xeniface/ioctl_store.c
@@ -91,35 +91,6 @@ __DisplayMultiSz(
 
 DECLSPEC_NOINLINE
 NTSTATUS
-IoctlLog(
-    __in  PXENIFACE_FDO     Fdo,
-    __in  PCHAR             Buffer,
-    __in  ULONG             InLen,
-    __in  ULONG             OutLen
-    )
-{
-    NTSTATUS    status;
-
-    status = STATUS_INVALID_BUFFER_SIZE;
-    if (InLen == 0 || OutLen != 0)
-        goto fail1;
-
-    status = STATUS_INVALID_PARAMETER;
-    if (!__IsValidStr(Buffer, InLen))
-        goto fail2;
-
-    XenIfaceDebugPrint(INFO, "USER: %s\n", Buffer);
-    return STATUS_SUCCESS;
-
-fail2:
-    XenIfaceDebugPrint(ERROR, "Fail2\n");
-fail1:
-    XenIfaceDebugPrint(ERROR, "Fail1 (%08x)\n", status);
-    return status;
-}
-
-DECLSPEC_NOINLINE
-NTSTATUS
 IoctlStoreRead(
     __in  PXENIFACE_FDO     Fdo,
     __in  PCHAR             Buffer,
diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c
index 7f172d7..8382000 100644
--- a/src/xeniface/ioctls.c
+++ b/src/xeniface/ioctls.c
@@ -160,6 +160,53 @@ XenIfaceCleanup(
     }
 }
 
+static FORCEINLINE
+BOOLEAN
+__IsValidStrFix(
+    __in  PCHAR             Str,
+    __in  ULONG             Len
+    )
+{
+    for ( ; Len--; ++Str) {
+        if (*Str == '\0')
+            return TRUE;
+        if (*Str == '\n' || *Str == '\r')
+            continue;
+        if (!isprint((unsigned char)*Str))
+            break;
+    }
+    return FALSE;
+}
+
+DECLSPEC_NOINLINE
+NTSTATUS
+IoctlLog(
+    __in  PXENIFACE_FDO     Fdo,
+    __in  PCHAR             Buffer,
+    __in  ULONG             InLen,
+    __in  ULONG             OutLen
+    )
+{
+    NTSTATUS    status;
+
+    status = STATUS_INVALID_BUFFER_SIZE;
+    if (InLen == 0 || OutLen != 0)
+        goto fail1;
+
+    status = STATUS_INVALID_PARAMETER;
+    if (!__IsValidStrFix(Buffer, InLen))
+        goto fail2;
+
+    XenIfaceDebugPrint(INFO, "USER: %s\n", Buffer);
+    return STATUS_SUCCESS;
+
+fail2:
+    XenIfaceDebugPrint(ERROR, "Fail2\n");
+fail1:
+    XenIfaceDebugPrint(ERROR, "Fail1 (%08x)\n", status);
+    return status;
+}
+
 NTSTATUS
 XenIfaceIoctl(
     __in     PXENIFACE_FDO     Fdo,
-- 
1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://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®.