From 084ebe5035f23491acae9b2e8351e24ac2d6b133 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 11 Nov 2023 20:41:10 +1100 Subject: [PATCH] [host] dxgi: fix potential buffer out of bounds access --- host/platform/Windows/capture/DXGI/src/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/platform/Windows/capture/DXGI/src/util.c b/host/platform/Windows/capture/DXGI/src/util.c index 9f79218a..1978f714 100644 --- a/host/platform/Windows/capture/DXGI/src/util.c +++ b/host/platform/Windows/capture/DXGI/src/util.c @@ -151,7 +151,7 @@ static const char * DXGI_FORMAT_STR[] = { const char * getDXGIFormatStr(DXGI_FORMAT format) { - if (format > sizeof(DXGI_FORMAT_STR) / sizeof(const char *)) + if (format >= sizeof(DXGI_FORMAT_STR) / sizeof(const char *)) return DXGI_FORMAT_STR[0]; return DXGI_FORMAT_STR[format]; } @@ -190,7 +190,7 @@ const char * getDXGIColorSpaceTypeStr(DXGI_COLOR_SPACE_TYPE type) if (type == DXGI_COLOR_SPACE_CUSTOM) return "DXGI_COLOR_SPACE_CUSTOM"; - if (type > sizeof(DXGI_COLOR_SPACE_TYPE_STR) / sizeof(const char *)) + if (type >= sizeof(DXGI_COLOR_SPACE_TYPE_STR) / sizeof(const char *)) return "Invalid or Unknown"; return DXGI_COLOR_SPACE_TYPE_STR[type];