Skip to content
Snippets Groups Projects
Commit 57d66ef1 authored by liwugang's avatar liwugang
Browse files

Fix the bound size and the variable name


It will not end when other words appeared because of the wrong bound and variable,
rule_map->length will exceed the actual length in the rule_map_new function,
it will lead to crash in the rule_map_validate function because of strcmp(NULL, str).

Test: 1.add "user=shell doman=system_app" to private/seapp_contexts
      2.exec "checkseapp private/seapp_contexts" and it will not be crashed

Change-Id: I600206448b38cf2c9b61f9141b40f920b05696c8
Signed-off-by: default avatarliwugang <liwugang@xiaomi.com>
parent f0dc0936
No related branches found
No related tags found
No related merge requests found
......@@ -742,7 +742,7 @@ static rule_map *rule_map_new(kvp keys[], size_t num_of_keys, int lineno,
/* Only assign key name to map name */
if (strcasecmp(k->key, x->name)) {
if (i == KVP_NUM_OF_RULES) {
if (j == KVP_NUM_OF_RULES - 1) {
log_error("No match for key: %s\n", k->key);
goto err;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment