summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2009-09-17 23:57:47 -0400
committerEamon Walsh <ewalsh@tycho.nsa.gov>2009-09-17 23:57:47 -0400
commit758f9402d3fcffb5360ef74c105d27070c7b7a09 (patch)
tree7f38835024cb16224cccb3063ccab8fa13c12fe1
parent55e6516104e223ca777a30b6a757894ff36a0ef3 (diff)
Discard the clearance level when matching.HEADmaster
Fixes a bug where ranges were causing matches to fail.
-rw-r--r--src/mcscolor.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mcscolor.c b/src/mcscolor.c
index ebe5be0..b3df206 100644
--- a/src/mcscolor.c
+++ b/src/mcscolor.c
@@ -97,12 +97,17 @@ static int check_dominance(const char *pattern, const char *raw) {
struct av_decision avd;
int rc = -1;
context_t my_tmp;
- const char *raw_range;
+ char *raw_range;
con = context_new(raw);
if (!con)
return -1;
- raw_range = context_range_get(con);
+ raw_range = strdup(context_range_get(con));
+ if (!raw_range) {
+ context_free(con);
+ return -1;
+ }
+ *strchrnul(raw_range, '-') = '\0';
my_tmp = context_new(my_context);
if (!my_tmp) {
@@ -129,6 +134,7 @@ static int check_dominance(const char *pattern, const char *raw) {
rc = (bit & avd.allowed) != bit;
out:
+ free(raw_range);
free(ctx);
context_free(my_tmp);
context_free(con);