glsl/cl: Prevent possible string overflow.

This commit is contained in:
Vinson Lee
2010-02-20 23:27:07 -08:00
parent dbaa845153
commit ae41339d4c
+2 -1
View File
@@ -387,7 +387,8 @@ _error(struct parse_context *ctx,
const char *msg)
{
if (ctx->error[0] == '\0') {
strcpy(ctx->error, msg);
strncpy(ctx->error, msg, sizeof(ctx->error) - 1);
ctx->error[sizeof(ctx->error) - 1] = '\0';
}
}