Skip to content

Commit

Permalink
Make sure assembly source in test program is null-terminated.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Dec 12, 2008
1 parent cb25c34 commit cc6693e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion finderrors.c
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit cc6693e

Please sign in to comment.