glsl/cl: Prevent possible buffer overflow.

This commit is contained in:
Vinson Lee 2010-02-21 00:36:50 -08:00
parent f56c9c2b19
commit d1aafb33b5
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}