progs/vp: Ensure null-terminated byte string.
authorVinson Lee <vlee@vmware.com>
Sun, 3 Jan 2010 10:38:22 +0000 (02:38 -0800)
committerVinson Lee <vlee@vmware.com>
Sun, 3 Jan 2010 10:38:22 +0000 (02:38 -0800)
progs/vp/vp-tris.c

index 29cd027..09236c2 100644 (file)
@@ -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);