|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 20/21] xenvif: Check the statistic name in frontend
CodeAnalysis raised a warning on this condition.
Name comes from the VIF interface caller and was only checked with an
ASSERT, so a release build could read past the end of the statistics
array. Return early when the name is out of range.
Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
src/xenvif/frontend.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index a35ed78..4b4e69f 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -1800,6 +1800,10 @@ __FrontendQueryStatistic(
ASSERT3U(Name, <, XENVIF_VIF_STATISTIC_COUNT);
*Value = 0;
+
+ if (Name >= XENVIF_VIF_STATISTIC_COUNT)
+ return;
+
for (Index = 0; Index < Frontend->StatisticsCount; Index++) {
PXENVIF_FRONTEND_STATISTICS Statistics;
--
2.55.0.windows.5
--
Césaire Mounah | Vates Windows Guest Tools Engineer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |