Mesa (master): glsl/cl: Prevent possible string overflow.
Vinson Lee
vlee at kemper.freedesktop.org
Sun Feb 21 07:29:47 UTC 2010
Module: Mesa
Branch: master
Commit: ae41339d4ce7c642c03a8d6f5310a68422261150
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae41339d4ce7c642c03a8d6f5310a68422261150
Author: Vinson Lee <vlee at vmware.com>
Date: Sat Feb 20 23:27:07 2010 -0800
glsl/cl: Prevent possible string overflow.
---
src/glsl/cl/sl_cl_parse.c | 3 ++-
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 8106ff6..2291ec2 100644
--- a/src/glsl/cl/sl_cl_parse.c
+++ b/src/glsl/cl/sl_cl_parse.c
@@ -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';
}
}
More information about the mesa-commit
mailing list