From a0b9bba5c888082a716cedfe9b47dd7828b9f3fe Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 27 Mar 2013 13:30:53 -0400 Subject: [PATCH] Fix: filter string comparison should check for literal The prior fix "Fix: filter string wildcard comparison" missed check for string literal. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-filter-interpreter.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/liblttng-ust/lttng-filter-interpreter.c b/liblttng-ust/lttng-filter-interpreter.c index 8d74e7f9..86409608 100644 --- a/liblttng-ust/lttng-filter-interpreter.c +++ b/liblttng-ust/lttng-filter-interpreter.c @@ -60,27 +60,27 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type) 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') { - diff = 0; + return 0; } else { - ret = parse_char(&q); - if (ret == -1) - diff = 0; - else - diff = -1; + if (estack_ax(stack, top)->u.s.literal) { + ret = parse_char(&q); + if (ret == -1) + return 0; + } + return -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') { - diff = 0; + return 0; } else { - ret = parse_char(&p); - if (ret == -1) - diff = 0; - else - diff = 1; + if (estack_bx(stack, top)->u.s.literal) { + ret = parse_char(&p); + if (ret == -1) + return 0; + } + return 1; } - break; } if (estack_bx(stack, top)->u.s.literal) { ret = parse_char(&p); -- 2.34.1