From cc6693ec6831257170954accf8e411fe09eb0abd Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 12 Dec 2008 04:22:33 -0500 Subject: [PATCH] Make sure assembly source in test program is null-terminated. --- finderrors.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finderrors.c b/finderrors.c index 21f94183..00925620 100644 --- a/finderrors.c +++ b/finderrors.c @@ -71,7 +71,7 @@ static int do_file(const char *profile, const char *dname, const char *fn, int * } // 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 @@ static int do_file(const char *profile, const char *dname, const char *fn, int * { 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) {