From 26d8b2744961312116c4f060e22f5ec1517786f5 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 27 Mar 2013 10:50:56 -0400 Subject: [PATCH] Fix: filter string wildcard comparison wildcards * should match 0 or more characters (not 1 or more). Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-filter-interpreter.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/liblttng-ust/lttng-filter-interpreter.c b/liblttng-ust/lttng-filter-interpreter.c index 4b75f0bc..8d74e7f9 100644 --- a/liblttng-ust/lttng-filter-interpreter.c +++ b/liblttng-ust/lttng-filter-interpreter.c @@ -59,17 +59,27 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type) int escaped_r0 = 0; if (unlikely(p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0')) { - if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') + if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') { diff = 0; - else - diff = -1; + } else { + ret = parse_char(&q); + if (ret == -1) + diff = 0; + else + diff = -1; + } break; } if (unlikely(q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0')) { - if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') + if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') { diff = 0; - else - diff = 1; + } else { + ret = parse_char(&p); + if (ret == -1) + diff = 0; + else + diff = 1; + } break; } if (estack_bx(stack, top)->u.s.literal) { -- 2.34.1