From d1aafb33b5193db351ece5887edad1c908cbf36b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 21 Feb 2010 00:36:50 -0800 Subject: [PATCH] glsl/cl: Prevent possible buffer overflow. --- src/glsl/cl/sl_cl_parse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.30.2