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

[PATCH 10/18] xenvbd: Fix out-of-bounds read on empty StoreDirectory results


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Fri, 16 Oct 2026 15:26:47 +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:In-Reply-To:References:Feedback-ID"
  • Cc: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Delivery-date: Fri, 16 Oct 2026 13:27:11 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

StoreDirectory returns a list of NUL-separated names ending with an
empty string, but only allocated one byte after the payload. For an
empty directory the result was a single NUL, so callers walking the
list (e.g. __Next in fdo.c) read one byte past the allocation.

Allocate two extra bytes (the allocation is zeroed) so the list is
always double-NUL terminated.

Assisted-by: Claude:Claude-opus-5.5
Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xencrsh/store.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xencrsh/store.c b/src/xencrsh/store.c
index 03c9e2c..ef92238 100644
--- a/src/xencrsh/store.c
+++ b/src/xencrsh/store.c
@@ -913,7 +913,7 @@ StoreDirectory(
         goto fail1;
 
     Length = __StorePayloadLength(Response);
-    Buffer = AustereAllocate(Length + sizeof (CHAR));
+    Buffer = AustereAllocate(Length + 2 *sizeof (CHAR));
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
-- 
2.55.0.windows.5



--
Césaire Mounah | Vates Windows Guest Tools Engineer

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®.