From 7ae005e784979e524f56c7491e3acdd4cc7497bb Mon Sep 17 00:00:00 2001 From: "Huawei Technologies Co., Ltd" Date: Thu, 21 Jan 2021 10:57:09 +0800 Subject: [PATCH 1/3] bugfix: add check to avoid invalid ptr for strcmp If len of d_name is less than "pid", it will pass a invalid ptr to strcmp, which will cause crash. --- ...heck-to-avoid-invalid-ptr-for-strcmp.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bugfix-add-check-to-avoid-invalid-ptr-for-strcmp.patch diff --git a/bugfix-add-check-to-avoid-invalid-ptr-for-strcmp.patch b/bugfix-add-check-to-avoid-invalid-ptr-for-strcmp.patch new file mode 100644 index 0000000..2ea2c76 --- /dev/null +++ b/bugfix-add-check-to-avoid-invalid-ptr-for-strcmp.patch @@ -0,0 +1,29 @@ +From 360a23478dda391daa056c08a7c564f5b350e43a Mon Sep 17 00:00:00 2001 +From: nocjj <1250062498@qq.com> +Date: Thu, 21 Jan 2021 10:57:09 +0800 +Subject: [PATCH] bugfix: add check to avoid invalid ptr for strcmp + +If len of d_name is less than "pid", it will pass a invalid ptr +to strcmp, which will cause crash. +--- + src/domain.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/domain.c b/src/domain.c +index 7f9173d..f8dea48 100644 +--- a/src/domain.c ++++ b/src/domain.c +@@ -253,6 +253,10 @@ static int check_pid_file(const char *d_name) + int extern_len = strlen(extern_name); + int len = strlen(d_name); + ++ if (len <= extern_len) { ++ return -1; ++ } ++ + return strcmp(d_name + len - extern_len, extern_name); + } + +-- +2.27.0 + -- Gitee From d98b10d811d97907230eb614d0b4ac26f2a855cb Mon Sep 17 00:00:00 2001 From: Euler Robot Date: Fri, 22 Jan 2021 10:46:40 +0800 Subject: [PATCH 2/3] spec: Update patch and changelog with !15 bugfix: add check to avoid invalid ptr for strcmp --- vmtop.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vmtop.spec b/vmtop.spec index 4b03652..10d47bf 100644 --- a/vmtop.spec +++ b/vmtop.spec @@ -27,6 +27,7 @@ Patch0016: proc-del-prc-pid-comm-read.patch Patch0017: display-del-screen-clear-after-key-response.patch Patch0018: arch-add-x86-kvm-exits-items.patch Patch0019: codestyle-del-unused-var.patch +Patch0020: bugfix-add-check-to-avoid-invalid-ptr-for-strcmp.patch Requires: libvirt, ncurses @@ -67,6 +68,9 @@ install -m 550 vmtop ${RPM_BUILD_ROOT}/usr/bin/%{name} %{_bindir}/vmtop %changelog +* Thu Jan 21 2021 Huawei Technologies Co., Ltd +- bugfix: add check to avoid invalid ptr for strcmp + * Thu 14 Jan 2021 Jiajun Chen <1250062498@qq.com> -1.1-2 - vcp_stat: add Max Scheduling Delay time items to display - args: add -p option -- Gitee From 1cd295767cf7c6c58889ea17b42df1eb765af69b Mon Sep 17 00:00:00 2001 From: Euler Robot Date: Fri, 22 Jan 2021 10:46:40 +0800 Subject: [PATCH 3/3] spec: Update release version with !15 increase release verison by one Signed-off-by: Euler Robot --- vmtop.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmtop.spec b/vmtop.spec index 10d47bf..e557e19 100644 --- a/vmtop.spec +++ b/vmtop.spec @@ -1,6 +1,6 @@ Name: vmtop Version: 1.1 -Release: 2 +Release: 3 Summary: A tool for collecting and analyzing data of virtual machine License: Mulan PSL V2 Group: Application/System -- Gitee