From: Vinson Lee Date: Sun, 21 Feb 2010 08:36:50 +0000 (-0800) Subject: glsl/cl: Prevent possible buffer overflow. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1aafb33b5193db351ece5887edad1c908cbf36b;p=mesa.git glsl/cl: Prevent possible buffer overflow. --- diff --git a/src/glsl/cl/sl_cl_parse.c b/src/glsl/cl/sl_cl_parse.c index 2291ec22004..9a20509fc66 100644 --- a/src/glsl/cl/sl_cl_parse.c +++ b/src/glsl/cl/sl_cl_parse.c @@ -2949,7 +2949,8 @@ sl_cl_compile(struct sl_pp_context *context, ctx.tokens_read = 0; ctx.tokens = malloc(ctx.tokens_cap * sizeof(struct sl_pp_token_info)); if (!ctx.tokens) { - strncpy(error, "out of memory", cberror); + strncpy(error, "out of memory", cberror - 1); + error[cberror - 1] = '\0'; return -1; }