diff options
author | Nick Kralevich <nnk@google.com> | 2014-07-12 10:22:09 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2014-07-12 10:24:15 -0700 |
commit | d26204e7d0a3be178a97d4920b82007e05a2a632 (patch) | |
tree | 999dde66dead2b826e3b58d08cc8d7f0b6afb92a | |
parent | c71644b06ebd417ef060f3f07472125516f86c41 (diff) | |
download | libsepol-d26204e7d0a3be178a97d4920b82007e05a2a632.tar.gz |
Fix for binary policy modules.
They do not retain the neverallow source information so we must
not assume that source_filename is set. Either need a new binary
module format if we want to propagate this information for modular
builds or get rid of binary modules.
Change-Id: Ia86a04516bb7ea45c9036a84fcb10920e15531bf
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Bug: https://code.google.com/p/android/issues/detail?id=73183
-rw-r--r-- | src/expand.c | 8 | ||||
-rw-r--r-- | src/link.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/expand.c b/src/expand.c index 947bee0..acb6906 100644 --- a/src/expand.c +++ b/src/expand.c @@ -2651,9 +2651,11 @@ static int copy_neverallow(policydb_t * dest_pol, uint32_t * typemap, avrule->line = source_rule->line; avrule->flags = source_rule->flags; avrule->source_line = source_rule->source_line; - avrule->source_filename = strdup(source_rule->source_filename); - if (!avrule->source_filename) - goto err; + if (source_rule->source_filename) { + avrule->source_filename = strdup(source_rule->source_filename); + if (!avrule->source_filename) + goto err; + } if (ebitmap_cpy(&avrule->stypes.types, &stypes)) goto err; @@ -1326,9 +1326,11 @@ static int copy_avrule_list(avrule_t * list, avrule_t ** dst, } new_rule->line = cur->line; new_rule->source_line = cur->source_line; - new_rule->source_filename = strdup(cur->source_filename); - if (!new_rule->source_filename) - goto cleanup; + if (cur->source_filename) { + new_rule->source_filename = strdup(cur->source_filename); + if (!new_rule->source_filename) + goto cleanup; + } cur = cur->next; |