Skip to content
Snippets Groups Projects
Commit dfd4cfc3 authored by Kenny Root's avatar Kenny Root Committed by Android Git Automerger
Browse files

am fc6b1032: Merge changes I98fc14e1,If334ba73

* commit 'fc6b1032':
  Fix for segfault/jmp depends on unitialized variable
  Fix check_seapp segfault and undefined linking err
parents 2e44ea3c fc6b1032
No related branches found
No related tags found
No related merge requests found
...@@ -277,15 +277,18 @@ static int key_map_validate(key_map *m, int lineno) { ...@@ -277,15 +277,18 @@ static int key_map_validate(key_map *m, int lineno) {
log_error("Could not check selinux boolean, error: %s\n", log_error("Could not check selinux boolean, error: %s\n",
strerror(errno)); strerror(errno));
rc = 0; rc = 0;
goto bool_err; sepol_bool_key_free(se_key);
goto out;
} }
if(!resp) { if(!resp) {
log_error("Could not find selinux boolean \"%s\" on line: %d in file: %s\n", log_error("Could not find selinux boolean \"%s\" on line: %d in file: %s\n",
value, lineno, out_file_name); value, lineno, out_file_name);
rc = 0; rc = 0;
goto bool_err; sepol_bool_key_free(se_key);
goto out;
} }
sepol_bool_key_free(se_key);
} }
else if (!strcasecmp(key, "type") || !strcasecmp(key, "domain")) { else if (!strcasecmp(key, "type") || !strcasecmp(key, "domain")) {
...@@ -296,7 +299,6 @@ static int key_map_validate(key_map *m, int lineno) { ...@@ -296,7 +299,6 @@ static int key_map_validate(key_map *m, int lineno) {
} }
goto out; goto out;
} }
else if (!strcasecmp(key, "level")) { else if (!strcasecmp(key, "level")) {
ret = sepol_mls_check(pol.handle, pol.db, value); ret = sepol_mls_check(pol.handle, pol.db, value);
...@@ -308,9 +310,6 @@ static int key_map_validate(key_map *m, int lineno) { ...@@ -308,9 +310,6 @@ static int key_map_validate(key_map *m, int lineno) {
} }
} }
bool_err:
sepol_bool_key_free(se_key);
out: out:
log_info("Key map validate returning: %d\n", rc); log_info("Key map validate returning: %d\n", rc);
return rc; return rc;
...@@ -500,19 +499,23 @@ static rule_map *rule_map_new(kvp keys[], unsigned int num_of_keys, int lineno) ...@@ -500,19 +499,23 @@ static rule_map *rule_map_new(kvp keys[], unsigned int num_of_keys, int lineno)
/* Only build key off of inputs*/ /* Only build key off of inputs*/
if (r->dir == dir_in) { if (r->dir == dir_in) {
char *tmp; char *tmp;
int l = strlen(k->key); int key_len = strlen(k->key);
l += strlen(k->value); int val_len = strlen(k->value);
l += (new_map->key) ? strlen(new_map->key) : 0; int l = (new_map->key) ? strlen(new_map->key) : 0;
l = l + key_len + val_len;
l += 1; l += 1;
tmp = realloc(new_map->key, l); tmp = realloc(new_map->key, l);
if (!tmp) if (!tmp)
goto oom; goto oom;
if (!new_map->key)
memset(tmp, 0, l);
new_map->key = tmp; new_map->key = tmp;
strcat(new_map->key, k->key); strncat(new_map->key, k->key, key_len);
strcat(new_map->key, k->value); strncat(new_map->key, k->value, val_len);
} }
break; break;
} }
...@@ -619,7 +622,7 @@ static void init() { ...@@ -619,7 +622,7 @@ static void init() {
log_info("Output file set to: %s\n", (out_file_name == NULL) ? "stdout" : out_file_name); log_info("Output file set to: %s\n", (out_file_name == NULL) ? "stdout" : out_file_name);
#if !defined(LINK_SEPOL_STATIC) #if !defined(LINK_SEPOL_STATIC)
log_warning("LINK_SEPOL_STATIC is not defined\n""Not checking types!"); log_warn("LINK_SEPOL_STATIC is not defined\n""Not checking types!");
#endif #endif
} }
......
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