[igt-dev] [PATCH i-g-t] tools/intel_reg: fix use-after-free bug in register spec read

Ser, Simon simon.ser at intel.com
Wed Aug 21 13:40:17 UTC 2019


On Wed, 2019-08-21 at 16:09 +0300, Jani Nikula wrote:
> e points into the buffer pointer to by p.

Typo: pointed

> 
> Fixes: dfda0b6aecce ("intel_reg: introduce one intel_reg tool to rule them all")
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Simon Ser <simon.ser at intel.com>

> ---
>  tools/intel_reg_spec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/intel_reg_spec.c b/tools/intel_reg_spec.c
> index 0df69b6884de..5ab56ec1a31f 100644
> --- a/tools/intel_reg_spec.c
> +++ b/tools/intel_reg_spec.c
> @@ -233,9 +233,9 @@ static int parse_line(struct reg *reg, const char *line)
>  			reg->name = p;
>  		} else if (i == 2) {
>  			reg->addr = strtoul(p, &e, 16);
> -			free(p);
>  			if (*e)
>  				ret = -1;
> +			free(p);
>  		} else if (i == 3) {
>  			ret = parse_port_desc(reg, p);
>  			free(p);


More information about the igt-dev mailing list