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

[PATCH] store: Detect bad response from xenstored


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Wed, 26 Aug 2026 11:23:02 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Feedback-ID"
  • Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Wed, 26 Aug 2026 09:23:11 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Detect when Header.len is larger than allowed, and fail the request.
A length of 0 is valid for some operations.
Also modify StoreVerifyHeader to fail on length > XENSTORE_PAYLOAD_MAX

Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

Ported from XenBus.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xencrsh/store.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/xencrsh/store.c b/src/xencrsh/store.c
index 7c5e078..cc7cf8b 100644
--- a/src/xencrsh/store.c
+++ b/src/xencrsh/store.c
@@ -376,7 +376,7 @@ __StoreVerifyHeader(
         Valid = FALSE;
     }
 
-    if (Header->len >= XENSTORE_PAYLOAD_MAX) {
+    if (Header->len > XENSTORE_PAYLOAD_MAX) {
         LogError("ILLEGAL LENGTH 0x%08x\n", Header->len);
         Valid = FALSE;
     }
@@ -404,6 +404,10 @@ StoreReceiveResponse(
     if (Response->Header.len == 0)
         goto done;
 
+    status = STATUS_INVALID_BUFFER_SIZE;
+    if (Response->Header.len > XENSTORE_PAYLOAD_MAX)
+        goto done;
+
     Response->Segment[RESPONSE_PAYLOAD_SEGMENT].Length = Response->Header.len;
     Response->Segment[RESPONSE_PAYLOAD_SEGMENT].Data = 
AustereAllocate(Response->Segment[RESPONSE_PAYLOAD_SEGMENT].Length);
     ASSERT(Response->Segment[RESPONSE_PAYLOAD_SEGMENT].Data != NULL);
-- 
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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