From 517712290efae5a83ac147b04e087f992a3def3c Mon Sep 17 00:00:00 2001 From: yixiangzhike Date: Sat, 27 Aug 2022 10:11:34 +0800 Subject: [PATCH] Fix coredump while parseServiceInfo return non-zero Signed-off-by: yixiangzhike --- chkconfig.spec | 7 +++++- ...dump-while-parseServiceInfo-return-1.patch | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 fix-coredump-while-parseServiceInfo-return-1.patch diff --git a/chkconfig.spec b/chkconfig.spec index 474bdf7..3709eac 100644 --- a/chkconfig.spec +++ b/chkconfig.spec @@ -1,7 +1,7 @@ Summary: A system tool for maintaining the /etc/rc*.d hierarchy Name: chkconfig Version: 1.20 -Release: 1 +Release: 2 License: GPLv2 URL: https://github.com/fedora-sysv/chkconfig Source: https://github.com/fedora-sysv/chkconfig/archive/refs/tags/%{version}.tar.gz @@ -11,6 +11,8 @@ Provides: ntsysv = %{version}-%{release} Obsoletes: ntsysv < %{version}-%{release} Provides: /sbin/chkconfig +Patch0: fix-coredump-while-parseServiceInfo-return-1.patch + %description Chkconfig is a basic system utility. It updates and queries runlevel information for system services. Chkconfig manipulates the numerous @@ -55,6 +57,9 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d %{_mandir}/man8/* %changelog +* Sat Aug 27 2022 yixiangzhike - 1.20-2 +- fix coredump while parseServiceInfo return non-zero + * Thu Dec 30 2021 wangchen - 1.20-1 - Update to 1.20 diff --git a/fix-coredump-while-parseServiceInfo-return-1.patch b/fix-coredump-while-parseServiceInfo-return-1.patch new file mode 100644 index 0000000..5addbf2 --- /dev/null +++ b/fix-coredump-while-parseServiceInfo-return-1.patch @@ -0,0 +1,25 @@ +From 05f7ea8fa198a6b98dd98cb1a8b1774da701e917 Mon Sep 17 00:00:00 2001 +From: xujing +Date: Fri, 12 Aug 2022 10:01:32 +0800 +Subject: [PATCH] fix coredump while parseServiceInfo return 1 + +--- + leveldb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/leveldb.c b/leveldb.c +index 7b8c1bd..8a7a81d 100644 +--- a/leveldb.c ++++ b/leveldb.c +@@ -377,7 +377,7 @@ int readServiceInfo(char *name, int type, struct service *service, + asprintf(&filename, RUNLEVELS "/chkconfig.d/%s", name); + if ((fd = open(filename, O_RDONLY)) >= 0) { + parseret = parseServiceInfo(fd, name, &serv_overrides, honorHide, 1); +- if (parseret >= 0) { ++ if (parseret == 0) { + if (serv_overrides.name) + serv.name = serv_overrides.name; + if (serv_overrides.levels != -1) +-- +2.27.0 +