From 2290ddeb89745d8ddc16796da91ae7b728e5b455 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Sat, 2 Mar 2024 20:35:18 +0800 Subject: [PATCH] Fix segfault when sepolicy.rule has empty line --- native/src/sepolicy/statement.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/native/src/sepolicy/statement.cpp b/native/src/sepolicy/statement.cpp index e6553c5c2..ca282d3a5 100644 --- a/native/src/sepolicy/statement.cpp +++ b/native/src/sepolicy/statement.cpp @@ -416,6 +416,7 @@ else if (strcmp(name, action) == 0) { \ #define add_action(act, type) add_action_func(#act, type, act) void sepolicy::parse_statement(rust::Str stmt) { + if (stmt.empty()) return; // strtok modify strings, create a copy string cpy(stmt.data(), stmt.length());