From: Mathieu Desnoyers Date: Mon, 16 Jul 2012 14:39:19 +0000 (-0400) Subject: Filter: validate that field ref strings are non-NULL X-Git-Tag: v2.1.0-rc1~28 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=33fb658e7862363d43e961a2d76cf3795927aa07;p=lttng-ust.git Filter: validate that field ref strings are non-NULL Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-filter.c b/liblttng-ust/lttng-filter.c index db4d107a..19775c30 100644 --- a/liblttng-ust/lttng-filter.c +++ b/liblttng-ust/lttng-filter.c @@ -696,6 +696,11 @@ int lttng_filter_interpret_bytecode(void *filter_data, ref->offset); reg[insn->reg].str = *(const char * const *) &filter_stack_data[ref->offset]; + if (unlikely(!reg[insn->reg].str)) { + dbg_printf("Filter warning: loading a NULL string.\n"); + ret = -EINVAL; + goto end; + } reg[insn->reg].type = REG_STRING; reg[insn->reg].seq_len = UINT_MAX; reg[insn->reg].literal = 0; @@ -716,6 +721,11 @@ int lttng_filter_interpret_bytecode(void *filter_data, reg[insn->reg].str = *(const char **) (&filter_stack_data[ref->offset + sizeof(unsigned long)]); + if (unlikely(!reg[insn->reg].str)) { + dbg_printf("Filter warning: loading a NULL sequence.\n"); + ret = -EINVAL; + goto end; + } reg[insn->reg].type = REG_STRING; reg[insn->reg].literal = 0; next_pc += sizeof(struct load_op) + sizeof(struct field_ref);