[Mesa-dev] [PATCH] i965: Don't write beyond allocated memory.

Matt Turner mattst88 at gmail.com
Fri Nov 13 12:03:36 PST 2015


On Fri, Nov 13, 2015 at 3:36 AM, Juha-Pekka Heikkila
<juhapekka.heikkila at gmail.com> wrote:
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/mesa/drivers/dri/i965/brw_eu_validate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_validate.c b/src/mesa/drivers/dri/i965/brw_eu_validate.c
> index eb57962..2de2ea1 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_validate.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_validate.c
> @@ -39,7 +39,7 @@ cat(struct string *dest, const struct string src)
>  {
>     dest->str = realloc(dest->str, dest->len + src.len + 1);
>     memcpy(dest->str + dest->len, src.str, src.len);
> -   dest->str[dest->len + src.len + 1] = '\0';
> +   dest->str[dest->len + src.len] = '\0';
>     dest->len = dest->len + src.len;
>  }
>  #define CAT(dest, src) cat(&dest, (struct string){src, strlen(src)})
> --

Nice. Thanks for catching that.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

(I'll push this)


More information about the mesa-dev mailing list