Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Put a simple sanity check in to prevent buffer overflows.
  • Loading branch information
icculus committed May 29, 2016
1 parent 14c5677 commit fd60b5e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mojoshader.c
Expand Up @@ -11169,8 +11169,13 @@ static Context *build_context(const char *profile,
return NULL;
} // if

if (mainfn)
ctx->mainfn = StrDup(ctx, mainfn);
if (mainfn != NULL)
{
if (strlen(mainfn) > 55) // !!! FIXME: just to keep things sane. Lots of hardcoded stack arrays...
failf(ctx, "Main function name '%s' is too big", mainfn);
else
ctx->mainfn = StrDup(ctx, mainfn);
} // if

if (profile != NULL)
{
Expand Down

0 comments on commit fd60b5e

Please sign in to comment.