Mesa (mesa_7_7_branch): progs/vp: Ensure null-terminated byte string.

Vinson Lee vlee at kemper.freedesktop.org
Sun Jan 3 10:39:04 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: 1da47ac20e676e05c1b0b66c2c07265836f4c7eb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1da47ac20e676e05c1b0b66c2c07265836f4c7eb

Author: Vinson Lee <vlee at vmware.com>
Date:   Sun Jan  3 02:38:22 2010 -0800

progs/vp: Ensure null-terminated byte string.

---

 progs/vp/vp-tris.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c
index 29cd027..09236c2 100644
--- a/progs/vp/vp-tris.c
+++ b/progs/vp/vp-tris.c
@@ -96,7 +96,8 @@ static void Init( void )
       exit(1);
    }
 
-   sz = (GLuint) fread(buf, 1, sizeof(buf), f);
+   sz = (GLuint) fread(buf, 1, sizeof(buf) - 1, f);
+   buf[sizeof(buf) - 1] = '\0';
    if (!feof(f)) {
       fprintf(stderr, "file too long\n");
       fclose(f);




More information about the mesa-commit mailing list