Fix: don't generate 0-len array in tracepoint probes
[lttng-ust.git] / liblttng-ust / lttng-filter-interpreter.c
index 29bcaeffa0656cacea08f59f5c6b782bb23c1af7..29e94eb98b4277b3c1d0052358b137ca3d13e425 100644 (file)
@@ -58,8 +58,8 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
        for (;;) {
                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 (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') {
                                return 0;
                        } else {
                                if (estack_ax(stack, top)->u.s.literal) {
@@ -70,17 +70,13 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
                                return -1;
                        }
                }
-               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') {
-                               return 0;
-                       } else {
-                               if (estack_bx(stack, top)->u.s.literal) {
-                                       ret = parse_char(&p);
-                                       if (ret == -1)
-                                               return 0;
-                               }
-                               return 1;
+               if (unlikely(q - estack_ax(stack, top)->u.s.str >= estack_ax(stack, top)->u.s.seq_len || *q == '\0')) {
+                       if (estack_bx(stack, top)->u.s.literal) {
+                               ret = parse_char(&p);
+                               if (ret == -1)
+                                       return 0;
                        }
+                       return 1;
                }
                if (estack_bx(stack, top)->u.s.literal) {
                        ret = parse_char(&p);
This page took 0.02455 seconds and 4 git commands to generate.