summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/cl/sl_cl_parse.c3
1 files changed, 2 insertions, 1 deletions
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;
}