Module: Mesa
Branch: master
Commit: d1aafb33b5193db351ece5887edad1c908cbf36b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1aafb33b5193db351ece5887edad1c908cbf36b

Author: Vinson Lee <[email protected]>
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;
    }
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to