]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[main] only look for a shell in valid returned prefixed strings
authorCharlie Brej <cbrej@cs.man.ac.uk>
Wed, 21 Jul 2010 14:54:36 +0000 (15:54 +0100)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Wed, 21 Jul 2010 14:54:36 +0000 (15:54 +0100)
Fixes a segfault if no "init=" is present

src/main.c

index 7ab763bcd225fa7b18ae852d13810aa3a62d66b3..69a87455b5cb04435c8cd9e25f14da994ccc05f9 100644 (file)
@@ -656,9 +656,12 @@ plymouth_should_ignore_show_splash_calls (state_t *state)
 
   init_string = command_line_get_string_after_prefix (state->kernel_command_line, "init=");
 
-  length = strcspn (init_string, " \n");
-  if (length > 2 && ply_string_has_prefix (init_string + length - 2, "sh"))
-    return true;
+  if (init_string)
+    {
+      length = strcspn (init_string, " \n");
+      if (length > 2 && ply_string_has_prefix (init_string + length - 2, "sh"))
+       return true;
+    }
 
   return false;
 }