finderrors.c
changeset 509 88c18d64e95b
parent 507 0dd7a913f498
child 515 58c1a7d98176
--- a/finderrors.c	Fri Dec 12 04:10:25 2008 -0500
+++ b/finderrors.c	Fri Dec 12 04:22:33 2008 -0500
@@ -71,7 +71,7 @@
     } // if
 
     static unsigned char buf[1024 * 256];
-    int rc = fread(buf, 1, sizeof (buf), io);
+    int rc = fread(buf, 1, sizeof (buf)-1, io);
     fclose(io);
     if (rc == -1)
     {
@@ -83,6 +83,7 @@
     {
         const MOJOSHADER_parseData *a;
 
+        buf[rc] = '\0';  // make sure the source is null-terminated.
         a = MOJOSHADER_assemble((char *) buf, 0, 0, 0);
         if (a->error)
         {