On Tue, 15 Dec 2020 12:45:40 -0400 Jesse Smith <jsm...@resonatingmedia.com> wrote:
> I gave the patch a test run and, while I like what it does in theory, > in practise I'm running into trouble with it. When I use the attached > patch and then run "make check" in the insserv source directory, > inssrev segfaults after about eight tests. I haven't had a chance yet > to hunt down what is causing the problem, but I'm guessing a variable > is getting used before it is given a value/initialized. well, moving the Start_Stop_Overlap call broke the assumption that start_levels and stop_levels are never undefined, so this additional patch should fix the regression make check now passes all 240 tests thanks for the review and happy hacking! :)
>From 4a3b1e90f23792b6f640e8d9bc28c334cafce843 Mon Sep 17 00:00:00 2001 From: Trek <tre...@inbox.ru> Date: Tue, 15 Dec 2020 20:00:18 +0100 Subject: [PATCH 3/3] Skip overlapping check on empty runlevels --- insserv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/insserv.c b/insserv.c index dbd3202..b7e1d8f 100644 --- a/insserv.c +++ b/insserv.c @@ -2737,6 +2737,8 @@ boolean Start_Stop_Overlap(char *start_levels, char *stop_levels) int string_index = 0; char *found; + if (!start_levels || !stop_levels) return false; + while (start_levels[string_index]) /* go to end of string */ { if (start_levels[string_index] != ' ') /* skip spaces */ -- 2.20.1