Mesa (master): glsl/cl: Prevent possible buffer overflow.
Vinson Lee
vlee at kemper.freedesktop.org
Sun Feb 21 08:37:41 UTC 2010
Module: Mesa
Branch: master
Commit: d1aafb33b5193db351ece5887edad1c908cbf36b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1aafb33b5193db351ece5887edad1c908cbf36b
Author: Vinson Lee <vlee at vmware.com>
Date: Sun Feb 21 00:36:50 2010 -0800
glsl/cl: Prevent possible buffer 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 2291ec2..9a20509 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;
}
More information about the mesa-commit
mailing list