]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/fireinfo-virt-fix-off-by-one-error-when-detecting-hypervisor.patch
wavemon: Update to version 0.9.5
[people/pmueller/ipfire-2.x.git] / src / patches / fireinfo-virt-fix-off-by-one-error-when-detecting-hypervisor.patch
1 From e3e68b9baa9723916b1999394432e9ad260cfaa2 Mon Sep 17 00:00:00 2001
2 From: Michael Tremer <michael.tremer@ipfire.org>
3 Date: Sat, 1 Jul 2023 09:08:48 +0000
4 Subject: [PATCH] virt: Fix off-by-one error when detecting hypervisor
5
6 Reported-by: Mauro Condarelli <mc5686@mclink.it>
7 Fixes: #13155 - _fireinfo.detect_hypervisor() rises Segmentation fault
8 Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
9 ---
10 src/_fireinfo/fireinfo.c | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13 diff --git a/src/_fireinfo/fireinfo.c b/src/_fireinfo/fireinfo.c
14 index 1d3f424..18edf34 100644
15 --- a/src/_fireinfo/fireinfo.c
16 +++ b/src/_fireinfo/fireinfo.c
17 @@ -32,8 +32,8 @@ enum hypervisors {
18 HYPER_KVM,
19 HYPER_MSHV,
20 HYPER_VMWARE,
21 + // Must always be last
22 HYPER_OTHER,
23 - HYPER_LAST /* for loop - must be last*/
24 };
25
26 const char *hypervisor_ids[] = {
27 @@ -157,7 +157,7 @@ int detect_hypervisor(int *hypervisor) {
28 *hypervisor = HYPER_OTHER;
29
30 if (*sig.text) {
31 - for (int id = HYPER_NONE + 1; id < HYPER_LAST; id++) {
32 + for (int id = HYPER_NONE + 1; id < HYPER_OTHER; id++) {
33 if (strcmp(hypervisor_ids[id], sig.text) == 0) {
34 *hypervisor = id;
35 break;
36 --
37 2.39.2
38